Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

sarah sturgeon

+ Follow
since Aug 27, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sarah sturgeon

Thanks Jean and Fred for detailed reply. I finally got it and I really appreciate your help and patience.
9 years ago

Thanks Fred.

Ok i understand the relationship between objects and its class.
However , i am not cleared how to create objects from a class.

The above link illustrates how the objects are created from a class

Following the above link, can i create two objects car1 and car2 from class Car as shown below

Car car1 = new Car ( );
Car car2= new Car ( ) ;

is this correct understanding ?

Second thing How do i import user-created class in my source file if not defined in it ?

Thanks for all your help.
9 years ago
Thanks Fred

One class extends to only one class

So if we have by-cycle as a class, mountain by-cycle class extends to by-cycle class, we can not create a class mountain cycle 1 and extends it to mountain by-cycle class because it will extending mountain by-cycle 1 class to two classes: mountain by-cycle and cycle

Is my understanding correct ?

9 years ago
Thanks for your replies guys.

I appreciate your help , as for the trying out my scenario, I have no idea how to try it out as to day is my third day learning Java.


" Note that when people/books/web articles refer to a class having one super-class...they mean one DIRECT superclass"class "

"MyClass extends ClassA, ClassB, ClassC"

"thus MyClass has three direct super-classes".

Sorry Fred I am lost here If there can be only one direct super class , how come MyClass has three direct super classes ?

My second question When you use the word extend what does it mean here ?

Is it possible to create a subclass out of another subclass?
in my example, I created one class mountain by-cycle 1 from subclass mountain by-cycle which has by-cycle as super class. In this scenario, will both by-cycle and mountain by-cycle be considered super class for mountain by-cycle1 class ?

sorry for being repetitive , I am just trying to understand.


9 years ago
Hi every body.

I have few questions


Let say we created a class named Car in our source file.

In the same source file I want to create two objects car1,car2, based on class Car( that is i want to create two instances of class Car)

Can i create these objects as shown below:

Car car1 = new Car();
Car car2= new Car ( );

My second question is let say i am writing a different java program in a separate source file. I feel the need two create two objects car3 and car4 based on class Car.

1) In order to create these objects car3 and car4 in my program , the class Car must be imported in my source file . is it correct?
If correct, how do we do that ? I know for classes in API, we use import command.

I apologize for the long-winded post

Thanks and have a great day
9 years ago
Hi everybody

How is everyone doing ?

I was reading about inheritance with regard to classes. One of the link says a super class can have infinite number of subclasses but all all subclasses will have only one super class.

Let say we a by- cycle as a super class. Let assume mountain bike is one of the subclass of super class by-cycle.

Is it possible to create one class mountain by-cycle with mountain bike as super class ( keeping in mind class mountain by-cycle is already a subclass of super class by-cyle)?

Simply put is it possible to create a subclass from a class which is already a subclass of super class ?

If yes, then what would be considered super class for the subclass mountain by-cycle1 ? will it be Mountain by-cycle or by-cycle?

thanks and have a great day.
9 years ago
Thanks Jesper.

Could you please clarify the following:

Is Java ME subset of java se?

Is Java Se is the subset of java EE ?
9 years ago
Hi everybody

I want to calculate e^3 using Math.pow

I understand that I can do the following :

Math.pow (2.718,3) where 2.718 is the value of " e"

Is there anyway i can use " e" rather than its value for better accuracy e.g Math.pow( e,3) ?

Thanks and have a great a weekend.
9 years ago
HI everybody.

I understand there are different platforms for java ( Java se,java me, java EE),

What does make these platform differ from each other besides their usage for specific application ( e.g JavaEE is used to build enterprise-level application, Java ME is used to build application for small mobile devices)?

I am just going to guess as i am not sure is it API ?
9 years ago
Hi every body

I hope everyone is doing great. Please consider the following

Int a= 11,
String b= " Joe";
String c=" Ashley dr";

The goal is to pass these variables as parameters to " System.out.println command " so that we can display on screen the output: 11 Joe Ashley dr

How can i pass these variables as parameters ?

I tried:

System.out.println ( a, " ", b, " ", c);

But compiler kept giving error.

I hope someone could help with this.

Thanks and have a great weekend.

9 years ago