JagooIndia
Forum of Indian Youth
JAVA INTERVIEW QUES
Core Java
JDBC
Servlet
JSP
Struts
EJB
JMS
J2ME
RMI
Spring
Study Material, Ebooks
Electronics
Electrical
Computer Science /IT
Mechanical
Civil
Marketing
Finance
Technical Certificarion
Sun
Oracle
Microsoft
IBM
Cisco
PMI
Domain Certifications
Finance
Insurance
Project Management
   
 

 
 

Following topics are covered under Core java.
 

Language Fundamentals
 
Operators and assignment
 
Modifiers
 
Conversion Casting and Promotion
 
Flow Control and exception
 
Objects and Classes
 
Threads
 
java.lang & java.util Packages
 

Language Fundamentals

How many number of non-public class definitions can a source file have
A source file can contain unlimited number of non-public class definitions
List primitive data types, there size and there range (min, max)
Data Type Bytes bits min max
boolean
 
-
 
1
 
-
 
-
 
char
 
2
 
16
 
0
 
2^16-1
 
byte
 
1
 
8
 
-2^7
 
2^7-1
short
 
2
 
16
 
-2^15 2^15-1
int
 
4
 
32
 
-2^31 2^31-1
long
 
8
 
64
 
-2^63 2^63-1
float
 
4
 
32
 
-
 
-
 
double
 
8
 
64
 
-
 
-
 


 

What types of values does boolean variables take
It only takes values true and false

 
Which primitive datatypes are signed
 
All except char and Boolean

 
Is char type signed or unsigned
 
char type is integral but unsigned. It range is 0 to 2^7-1

 
What forms an integral literal can be
 
decimal, octal and hexadecimal, hence example it can be 28, 034 and 0x1c respectively

 
What is the default value of Boolean
 
False

 
Why is the main method static
 
So that it can be invoked without creating an instance of that class

 
What is the difference between class variable, member variable and automatic(local) variable
 
class variable is a static variable and does not belong to instance of class but rather shared across all the instances
member variable belongs to a particular instance of class and can be called from any method of the class
automatic or local variable is created on entry to a method and has only method scope

 
When are static and non static variables of the class initialized
 
The static variables are initialized when the class is loadedNon static variables are initialized just before the constructor is called

 
When are automatic variable initialized
 
Automatic variable have to be initialized explicitly

 
How is an argument passed in java, by copy or by reference
 
If the variable is primitive datatype then it is passed by copy.
If the variable is an object then it is passed by reference

 
What is garbage collection
 
The runtime system keeps track of the memory that is allocated and is able to determine whether that memory is still useable. This work is usually done in background by a low-priority thread that is referred to as garbage collector. When the gc finds memory that is no longer accessible from any live thread it takes steps to release it back to the heap for reuse

 
Does System.gc and Runtime.gc() guarantee garbage collection
 
No
 

 

 
 
   © Copyright Jagoo India.com. All right reserved.