Java was bought by Oracle corporation from Sun microsystems.
Q2 . Why java does not use pointers?
SOLUTION
Pointers use the memory location directly and also show the actual address this can lead to malicious manipulation of the data .This is the main reason for java avoiding pointer thereby making it robust.
Q3 . what is the differnce between Abstract class and interface?
SOLUTION
Abstract classes are classes defined with an abstract keyword and interfaces are with interface
Abstract classes can have all types of varibles like static or non static where as interfaces can only static and final variables.
Q4 . What is the differnce between structures and class?
SOLUTION
Java does not support structures.So let us compare structures and classes in general.
In structures all the members are of public visibility and classes have them as private.
Classes can be inherited whereas structures cannot.
Q5 . what are the access modifiers in java?
SOLUTION
Access modifiers decide the visibility and accessablility of various data members and functions in a class.the access specifiers are
>private-members can be accessed only by the same class members
>public can be used by any of the functions
>protect
Q6 . what is the use of an ternary operator?
SOLUTION
It is a conditional operator. Example
k< 1 ? a : b
the first part is the conditional K<1 depending on that a or b will be returned
if condition is true a is returned or else b is returned.
Q7 . What is the use of instanceof() operator?
SOLUTION
it is used to check if an instance belongs to specific type like a class .The instanceof() function returns a true or false depeding on if it is of that type or not.
Q8 . what are the iterative and flow control statements in Java?
SOLUTION
Java support iterative statements like
for loop
while loop
do while loop
It support flow control statements like
if else()
switch() statement.
Q9 . Does java support goto?
SOLUTION
Java does not support goto.
Q10 . what is a method?
SOLUTION
Methods are group of instruction that can be invoked by a single name .let us take an example