aspose file tools*
The moose likes Beginning Java and the fly likes Refer the program given Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Refer the program given" Watch "Refer the program given" New topic
Author

Refer the program given

Abhijit Kangale
Ranch Hand

Joined: Sep 17, 2009
Posts: 39
Hi all,

In the following program how many reference varibale & how many objects are there....? please justify if possible.

class animal
{
public void eat()
{
System.out.println("you are in animal");
}
}

class horse extends animal
{
public void eat()
{
System.out.println("you are in horse");
}

}

public class Flo
{
public static void main(String args[])
{
animal d=new animal();
animal f=new horse();
d.eat();
f.eat();

}
}

Thanks & Regards,
ABHIJIT
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874



In the following program how many reference varibale & how many objects are there....? please justify if possible.


What do you think the answer is ?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
Please use the code button so we can read it, and "Refer the program given" doesn't tell us what the thread is about.
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

Hi Abhijit,
There are . . .


SCJP 5.0 - JavaRanch FAQ - Java Beginners FAQ - SCJP FAQ - SCJP Mock Tests - Tutorial - JavaSE7 - JavaEE6 -Generics FAQ - JLS - JVM Spec - Java FAQs - Smart Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
Ninad Kulkarni, please have a look at the Beginning Java forum title page, where is says not to give answers. Abhijit Kangale will learn much more by counting the objects than being told.
Please don't be annoyed with me, but I have "pulled rank" and transferred your answer to our "deleted" forum.
Ninad Kulkarni
Ranch Hand

Joined: Aug 31, 2007
Posts: 787

Hello Campbell Ritchie. It happened by mistake. I apologize for that. I won't do that again.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
Apology accepted
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Campbell Ritchie wrote:Apology accepted


Aah we can't accept apologies, because Ninad is not allowed to say sorry , so now he'll have to say sorry for saying sorry (I hope this is funny, otherwise someone will kill me for making Poor Jokes)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38353
    
  23
Only if you say sorry for that joke . . .

Have you worked out how many objects there were?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9293
    
  17

Only if you say sorry for that joke . . .

I never say sorry for my jokes, so sorry but no sorry (another joke)

Campbell Ritchie wrote:Have you worked out how many objects there were?

Who me, I won't even try to answer that, otherwise you'll "pull the rank" again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Refer the program given