Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers
Antivirus Faqs_Questions_And_Answers Software Tips Faqs_Questions_And_Answers ERP Faqs_Questions_And_Answers Internet Faqs_Questions_And_Answers Spoken English Faqs_Questions_And_Answers Web Designing Faqs_Questions_And_Answers SEO Tips Faqs_Questions_And_Answers Hacking
Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers Faqs_Questions_And_Answers
SAP Faqs
C Faqs        C++ Faqs        Java Faqs        J2ee Faqs        Springs Faqs        Hibernate Faqs        Web sphere Faqs        Web Logic Server Faqs   
WordPress        Siebel Faqs        Shell Scripting Faqs        Perl Scripting Faqs        Open Source        Data Ware Housing Faqs        Joomla Faqs
Ajax        Oracle Apps Faqs        Testing Tools Faqs        Mainframes Faqs        Tibco Faqs        PHP Faqs        .Net Faqs       Operating System
 
Custom Search
RMI Interview Questions
EJB Interview Questions
JSP Interview Questions
JMS Interview Questions
JDBC Interview Questions
OOPS Interview Questions
Servlet Interview Questions
Applets Interview Questions
Awt Swing Interview Questions
Java Threads Interview Questions
Architectures of Java Faqs
Java Lang Package Faqs
Architectures of Java Faqs
Java Garbage Collection Faqs
Java Exception Handling Faqs
Core Java and Advanced Java
JAVA job interview Q&A
41 When is static variable loaded? Is it at compile time or runtime?
Ans: Static variable are loaded when classloader brings the class to the JVM. It is not necessary that an object has to be created. Static variables will be allocated memory space when they have been loaded. The code in a static block is loaded/executed only once i.e. when the class is first initialized. A class can have any number of static blocks. Static block is not member of a class, they do not have a return statement and they cannot be called directly. Cannot contain this or super. They are primarily used to initialize static fields.
42 What is the difference between declaring a variable and defining a variable?
Ans:

In declaration we only mention the type of the variable and its name without initializing it. Defining means declaration + initialization. E.g. String s; is just a declaration while String s = new String ("bob"); Or String s = "bob"; are both definitions passing do.

43 What type of parameteres Java support?
Ans:

In Java the arguments (primitives and objects) are always passed by value. With objects, the object reference itself is passed by value and so both the original reference and parameter copy both refer to the same object.

44 What do you understand by numeric promotion?
Ans:

The Numeric promotion is the conversion of a smaller numeric type to a larger numeric type, so that integral and floating-point operations may take place. In the numerical promotion process the byte, char, and short values are converted to int values. The int values are also converted to long values, if necessary. The long and float values are converted to double values, as required.

45 What do you understand by casting in java language? What are the types of casting?
Ans:

The process of converting one data type to another is called Casting. There are two types of casting in Java; these are implicit casting and explicit casting.

46 What is the first argument of the String array in main method?
Ans:

The String array is empty. It does not have any element. This is unlike C/C++ where the first element by default is the program name. If we do not provide any arguments on the command line, then the String array of main method will be empty but not null.

47 How can one prove that the array is not null but empty?
Ans:

Print array.length. It will print 0. That means it is empty. But if it would have been null then it would have thrown a NullPointerException on attempting to print array.length.

48

Can an application have multiple classes having main method?

Ans:

Yes. While starting the application we mention the class name to be run. The JVM will look for the main method only in the class whose name you have mentioned. Hence there is not conflict amongst the multiple classes having main method.

49

What is the ResourceBundle class?

Ans:

The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.

50 Can I have multiple main methods in the same class?
Ans:

No the program fails to compile. The compiler says that the main method is already defined in the class.

 
Page :    1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Top

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player