I was busy for the last few days as I was preparing for BJS 08. I am happy to share with you that the results are out and I performed very well and got scholarship also in that.
Today I am continuing my Q&A session on Java.
Q. What is java virtual machine and what is its uses?
Ans. JVM is basic run time environment for java applications. JVM is used to convert the machine code to byte code. Portability is the one of the features of java, i'ts done by using JVM.
Q.What is the priority of main thread in java? and why?...
Ans. The 'main()' method in Java is referred to the thread that is running, whenever a Java program runs. It calls the main thread because it is the first thread that starts running when a program begins. Other threads can be spawned from this main thread. The main thread must be the last thread in the program to end. When the main thread stops, the program stops running.
Main thread is created automatically, but it can be controlled by the program by using a Thread object. The Thread object will hold the reference of the main thread with the help of currentThread() method of the Thread class.
Q. What is the difference between Java and J2EE?
Ans. Java is a object-oriented programming language which is platform neutral. That is unlike C or C++, java programs can be run on any operating system with its JVM.
J2EE is a specification for server side programs. That is to support internet applications, distributed and uses component model. So that Enterprises use this server side technology in their distributed business. Since J2EE is a server side specification, anybody can implement
the specification but again using Java.
Q. Why java is not pure object oriented language?
Ans. For a pure object oriented language,there should be 6 features available with it.They are:
1. Encapsulation/Information Hiding
2. Inheritance
3. Polymorphisms/Dynamic Binding
4. All pre-defined types should be Objects
5. All operations performed by sending messages to Objects
6. All user-defined types are Objects
Object oriented paradigm of programming says that everything in a programming world should felt like object mean : "Abstract and Encapsulated" The paradigm is not completely satisfied by Java. Some of the feature that make such violation are
1. Existence of primitives which are manipulated in ordinary style .
2. Existence of mathematical operator handled also not like objects. These two essential characteristics make Java somewhat what is the question.
But here again Java is big winner to make presence of wrapper classes to wrap up this difficulty or adaption. Moreover in Java 1.5 you will feel more free because of auto-boxing feature that make auto conversion of object to primitive and primitive to object.
Q. Can String class be extendable? and why?
Ans. No.String class cannot be extened as it is final class.
String classes are once of the core classes provided by java library and probably is one of the most frequently used class as well. It is marked Final and CANNOT be extended. Classes are marked final in order to retain their behavior.
For Strings,It is because in case if someone extends the String class and overrides the methods, the behavior will become abnormal,thats why it is marked final.
Keep Reading!!...
Cheers
Padhaku Einstein
Contact me at einstein.padhaku@gmail.com
No comments:
Post a Comment