Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Re: Abstract Class

NickR2600-OracleMay 24 2018 — edited May 29 2018

Great question!  You're absolutely correct.  Abstract classes may contain methods with implementations.  These are called concrete methods.  Abstract classes may also contain methods without implementations.  These are called abstract methods.  To make a method abstract, you'd replace everything within the curly braces with a semi-colon.  So for example, an abstract printDetails() method would look like this:

public void printDetails();

Concrete classes, like SavingsAccount and CheckingAccount, can't contain abstract methods.  That means at some point in the inheritance structure, you'll need write a version of these methods with an implementation.  Otherwise, you won't be able to create instances of those classes.  In the case of SavingsAccount, this would be:

public void printDetails(){

     System.out.println(accountType +" #" +accountNum);

     System.out.println("Account Owner: " +accountOwner);

     System.out.println("Balance: $" +balance);

     System.out.println("Interest Rate: " +interestRate);

     System.out.println("");

}

And in CheckingAccount this would be:

public void printDetails(){

     System.out.println(accountType +" #" +accountNum);

     System.out.println("Account Owner: " +accountOwner);

     System.out.println("Balance: $" +balance);

     System.out.println("");

}


You'll notice both methods print the account owner and balance.  Generally, we want to reduce duplication like this.  It makes the code more maintainable if this functionality were written in a single place rather than duplicated.  This is because if we realize we've made a mistake or need to have additional functionality, we'd only need to make edits in one place.  This makes the printDetails() method of the Account super class the perfect place write this functionality once.  But doing so means the method can no longer be abstract.

Comments

SriniVEERAVALLI
Answer
Try IFNULL(expr, value)
for other column

"Fact - OLB Processed Invoices"."Invoice Amount - Functional Currency"+IFNULL("Fact - OLB Processed Invoices"."AR Tax Amount - Invoice Currency",0)

Edited by: Srini VEERAVALLI on Mar 20, 2013 10:02 AM
Marked as Answer by 994691 · Sep 27 2020
994691
Hi veeravalli ,
Thanks, I was trying for the same. But there was a problem with the server,I have restarted it,and now it is working. Thanks a lot.
1 - 2

Post Details

Added on May 24 2018
3 comments
730 views