Ans: IT is the concept of binding data along with its functionalities.
Comes into existence in order to Provide security for the data present inside
the program.
C++ Does not Support the Inheritance because the main Method Present
outside the class.
2) All keywords in java Start's with small letters.
3)Java Compiler will convert the source code into equivalent
byte code or .class file.
4)JVM Will convert the .class file into Equivalent Executable Code.
5) What is the Need of Creating an Object in Java?
Example java Program:
Class A
{
int x = 0;
public static void main(String[] args)
{
int y = 0;
y = y +1;
x = x + 1;
}
}
When This Program Executes, it generates a Run time Error.
saying that variable x is not available.
Reason :
When Main method loads into the RAM it does not have the variable x .
so main method cannot access the variable 'x'.or not available to RAM.
Where the variable still remains in HARD-DISK.
So through Object we can load the contents the hard-disk into RAM
5) What is Object ?
Answer : The memory in the RAM Which is Reserved for the non-static elements
of the .class file is known as OBJECT.
6) What is Instance ?
Answer: The Concept of reserving memory in the RAM dynamically (i.e., at run
time) for the contents of Hard disk is known as Instance.
Hence Object is Instance of Class.
Note : When Creating of an Object only signatures and address of non static
functions will be loaded into RAM.
7) What is Instance Variable and Local Variable?
Ans : Any non - static variable accommodate inside the instance and hence it
is known as Instance Variable.
Local Variable : Those that are defined inside the Function .
8) why Java is Robust ?
Answer : 1)Java is robust because no need to deal memory corruptions , because it does
not have pointers.
2) unauthorized access to memory is not possible in Java.
3) Emphasis on Checking:
Java has two levels of checking to avoid any corruptions.
1) Early checking ( compile time checking)
2) Run time checking.
4)Automatic memory management and garbage collection is the biggest
Strong type checking contributor here.
No comments:
Post a Comment