- What is JVM?
- What is a class loader?
- Where does the memory is allocated to the class?
- What are Native functions?
- Why Java is a simple programming language?
- What are object oriented concepts?
- What is a class?
- What is the difference between Method and Function?
- What is the difference between Public, Private and Protected?
Public,
Private and Protected are the three access specifiers. If we declare a
class as public then the members of that class can be accessed from any
other classes. If we declare a class as private, then the members of
that class cannot be accessed by any other class. If we declare a class
as protected it can be accessed by only some classes.
- Which is the default package in java?
- What is a static block?
The block of code which is created with a static keyword, this block of code is executed before the main() method execution.
eg: static{
;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;
} - What are the different ways to accept input from keyboard?
There are three different ways to accept input form keyboard:
using BufferedReader
using command line arguments and
- What is the error shows by the compiler if the main method is not available in program?
- Does Java supports overriding?
- Can we write a java program without using a class?
- What is an API?
An
API(Application Programming Interface) is a document that contains the
specifications that are to be followed while writing a program. It can
be in any format like .pdf, .html, .doc, .txt etc..,
- What is meant by a Garbage Collector? Can we invoke it manually?
- What is the difference between Assignment and Initialization?
The
process of assigning the value to the variable is called Assignment. We
can assign a value to a variable any number of times. The process of
assigning the value to the variable at the time of declaration is called
as Initialization. Initialization can be done only once.
- What is the difference between equals() and "=="?
- What is the output of the following code?
System.out.println("1"+2+3);
Output: 33
123
- Which of the following is the most restricted access specifier?
protected
friend
static
Default
Protected
- What is the difference between a constructor and a method?
A constructor is a member function of a class that is used to create objects of that class. It has the
same name as the class itself, has no return type, and is invoked using the new operator.
A
method is an ordinary member function of a class. It has its own name, a
return type (which may be void), and is invoked using the dot
operator.
- What is the purpose of garbage collection in Java, and when is it used?
The purpose of garbage collection is to identify and discard objects that are no longer needed by a
program so that their resources can be reclaimed and reused. A Java object is subject to garbage collection when it becomes unreachable to the program in which it is used.
- What is the difference between StringBuffer and StringBuilder?
- Which of the following is primarily accessed by the java compiler?(static block , static method, static variable.)
- What is the difference between Instance variables and Static variables(Class Variables)?
Instance Variables
|
Static Variables/Class
Variables
|
A separate copy
is available to each object
|
Single copy in memory is shared by all the objects
|
Instance
variables are created and stored in Heap Memory.
|
Static variables are stored in the Method area.
|
- What is the difference between Instance Methods and Static Methods?
- Why Instance variables are not accessed by the static methods?
- What is inheritance?
- Why Java does not support Multiple inheritance?
- How can we gain multiple inheritance in Java?
- Can we create the super class object in the subclass?
- What is polymorphism?
- What is meant by an abstract class?
- What is the difference between Interface and Abstract class?
- Can we create the object to the abstract class?
- What is meant by Interface?
- What is meant by type casting?
No comments:
Post a Comment