| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#1 (permalink) |
|
Moderator
Join Date: Feb 2006
Posts: 1,419
Thanks: 0 Thanked 18 Times in 13 Posts Thanks: 0
Thanked 18 Times in 13 Posts
Rep Power: 19
|
Answer the following 1)Can you have virtual functions in Java? 2)What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class? 3)what is a platform? 4)What is JVM? Edited by: keerthi
__________________
\"Winners don\'t do different things.They do things Differently\" |
|
|
|
|
|
#2 (permalink) |
|
Super Moderator
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117 Thanked 241 Times in 198 Posts Thanks: 117
Thanked 241 Times in 198 Posts
Blog Entries: 4
Rep Power: 51
|
3)what is a platform? It is an environment in which we can execute our programs. 4)What is JVM? It is an interpretor which converts java byte code into executable format so that the program can be executed in the given platform or environment. Edited by: sk_kireeti
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation. |
|
|
|
|
|
#3 (permalink) |
|
Junior Member
Join Date: Apr 2006
Location: India
Posts: 7
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 3
|
hi
1) in java functions are automatically virtual, i mean the method of that class will be called who's object is made. 2) It totaly depends upon the need of the code that what u 3) & 4) I am satisfied with the Kireeti's answer.. |
|
|
|
|
|
#4 (permalink) |
|
Junior Member
Join Date: Feb 2006
Location: India
Posts: 17
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 3
|
2)What is more advisable to create a thread, by implementing a Runnable interface or by extending Thread class? Runnable interface is more flexible to create a thread. implementing the Runnable interface only requires an implementation for the run() method. Since Runnable is an interface, you can still extend from another class. In thread class, a single inheritance facility provided in java. If you extended from one thread, you cannot extended from another thread. Where, Runnable interface can be exteneded from any other class.
__________________
Be dare in all your ways. |
|
|
|
|
|
#6 (permalink) |
|
Junior Member
Join Date: Feb 2006
Location: India
Posts: 17
Thanks: 0 Thanked 0 Times in 0 Posts Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 3
|
1) If we use any class,can create objects only. There isno modication on objects,if we implements an interface then we have own implementation? My openion is that , in java ifwe developimplementation objects are more flexible? Is there any facility in java?
__________________
Be dare in all your ways. |
|
|
|
|
|
#9 (permalink) |
|
Member
Join Date: Jan 2007
Posts: 32
Thanks: 3 Thanked 3 Times in 3 Posts Thanks: 3
Thanked 3 Times in 3 Posts
Rep Power: 2
|
Re: java contest-35
Q:- Can you have virtual functions in Java?
Reply : Virtual in c++ mean that it will give the latest implementation of the method in java mehtods are by default virtual. Ex: Class A{ public String firstTestMethod(String k,String n){ return ""; } } Class B Extends A{ public String firstTestMethod(String k,String n){ return "FromCLassB "+k+" "+n; } } Class C{ public static void main(String args[]){ B b=new B(); System.out.println(b.("Hello From","Main")); } } Out put is :FromCLassB Hello From Main
__________________
Cheers, Laxmi |
|
|
|
| The Following User Says Thank You to Laxminarayanak For This Useful Post: |
Shiva Shankar (23-01-07)
|
|
|
#10 (permalink) |
|
Member
Join Date: May 2007
Location: Bangalore
Posts: 37
Thanks: 1 Thanked 0 Times in 0 Posts Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 2
|
Re: java contest-35
no, we can't have global variables in java...
JVM has three things; 1. Class loader 2. class verifier 3. interpreter.....
__________________
Thanks & Regards, Deepesh The Language of Friendship is not Words but Meanings.... |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|