• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Refer the program given

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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



What do you think the answer is ?
 
Marshal
Posts: 76884
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please use the code button so we can read it, and "Refer the program given" doesn't tell us what the thread is about.
 
Ranch Hand
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Abhijit,
There are . . .
 
Campbell Ritchie
Marshal
Posts: 76884
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Campbell Ritchie. It happened by mistake. I apologize for that. I won't do that again.
 
Campbell Ritchie
Marshal
Posts: 76884
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apology accepted
 
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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)...
 
Campbell Ritchie
Marshal
Posts: 76884
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Only if you say sorry for that joke . . .

Have you worked out how many objects there were?
 
Ankit Garg
Sheriff
Posts: 9697
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Hey! Wanna see my flashlight? It looks like this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic