• Post Reply Bookmark Topic Watch Topic
  • New Topic

Define the simplest abstract class named....  RSS feed

 
Oscar E Rodriguez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Java.

I have been given an assignment which includes to:

"Define the SIMPLEST abstract class named foo"

I tried to answer this with the following:
thank you, in advance, for any assistance.

[edit]Corrected code tags. CR
[ December 12, 2008: Message edited by: Campbell Ritchie ]
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch

Believe it or not, you can get shorter than what you have already. And please us the code button rather than writing tags by hand.
 
Oscar E Rodriguez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
Welcome to JavaRanch

Believe it or not, you can get shorter than what you have already. And please us the code button rather than writing tags by hand.


Thank you for the welcome....and the response.
sorry about the hand written tags....

I don't believe it! I can't think how it could be shorter...but I know that is what my professor is looking for...
How's this:


thanks again for your feedback.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way you can get shorter than that would be to miss out the new line!

You've done it!
 
Oscar E Rodriguez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
The only way you can get shorter than that would be to miss out the new line!

You've done it!


THANK YOU, CAMPBELL!
Learning Java reminds me of my first year in med school. It's like learning a whole new way of thinking and a new language all at the same time!

So, let me see if I got this straight....when I "define an abstract class" I give it a name...that's all, right? Sort of like describing a drinking glass but not filling it with anything? Then someone else can define the classes to fill the abstract class like:


So if I want to create a glass of orange juice I have limited the kind of glass to be used....

Am I barking up the right tree here?

Thank you again for your help.
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More likely to be

public abstract class Vehicle . . .
public class Car extends Vehicle . . .
public class Bus extends Vehicle . . .

public abstract class Juice . . .
public class OrangeJuice extends Juice . . .
public class AppleJuice extends Juice . . .
public class FloridaOrangeJuice extends OrangeJuice . . .

You will doubtless have come across the concept of interfaces, too.

There is a major difference between learning medicine and learning computer science. In medicine ← is right and → is left. In computer science ↓ is up and ↑ is down. Actually computer science is harder; you have to be 100% right or your program won't run.
 
Oscar E Rodriguez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Campbell Ritchie:
More likely to be

public abstract class Vehicle . . .
public class Car extends Vehicle . . .
public class Bus extends Vehicle . . .

public abstract class Juice . . .
public class OrangeJuice extends Juice . . .
public class AppleJuice extends Juice . . .
public class FloridaOrangeJuice extends OrangeJuice . . .

You will doubtless have come across the concept of interfaces, too.

There is a major difference between learning medicine and learning computer science. In medicine ← is right and → is left. In computer science ↓ is up and ↑ is down. Actually computer science is harder; you have to be 100% right or your program won't run.


I TOTALLY AGREE! THANKS AGAIN FOR THE INFO.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although you probably hit CAPS by accident, could you please Keep It Down?
 
Oscar E Rodriguez
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Rob Prime:
Although you probably hit CAPS by accident, could you please Keep It Down?


Sorry about the caps....my bad
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!