Interview Q Answer Core Java From Youtube Video (AutoRecovered)
Interview Q Answer Core Java From Youtube Video (AutoRecovered)
2)what is encapsulation
Ans= encapsulation mean we bind code and data in single
specifier is called encapsulation.
For Example, =we can take capsule that we mix several
medicines in one capsule that is encapsulation
3) what is polymorphism
Ans= polymorphism is one task and many forms
For example we can take human like man at a home man can
be as father plays roles son and as husband and same
persona if go in shop his plays role as a customer
Polymorphism has two types
First one is runtime polymorphism and second one is compile
time polymorphism.
By using overriding we can achieve runtime polymorphism
And using method overloading method we can achieve
compile time polymorphism.
4)what is abstraction.
Ans= hiding the implementation details of a code and
exposing only the necessary information to the user
For example if u sending SMS to anyone but internal process
not see just only the main process show to user user don’t
know about internal process.
5)what is a interface
Ans=an interface cannot have constructors because we
cannot create object of an interface.
If you want a class to achieve multiple inheritance ,there is
only one way interface.
If an interface is made private, or if the methods in it are
made private or protected ,then a compilation error will be
throw
Interface can be used to achieve loose coupling
terfaces provide a way to achieve abstraction and multiple
inheritance in Java, allowing classes to share common
method signatures without being tightly coupled.
Interface is type of class and also reference type of java.
Interface contains public static final variables and abstract
method. main Purpose of Interface.... 1- once you defined
interface than we used any where in the application. 2- in
inheritance we can not define multiple inheritance using
class, but by using interface we can define multiple
inheritance.
6)what is string buffer class
1. String Buffer objects are mutable, meaning that you can
change the contents of the buffer without creating a new
object.
5)Method overriding.
Imp=in overriding method should be same. parameter should
be same.
Ans=When two or more parameter or more name are same
but they have also same parameter is called as overriding.
Ans= means when we have same name but different
parameter is called as overloaded.
7)overriding.
occurs when a subclass (child class) has the same method as
the parent class.
Overriding is solving runtime time polymorphism
8) what is hibernate
Ans= hibernate use for retrieving data and answer data into
the database.
Compile= The compile-time errors are the errors which are produced at
the compile-time, and they are detected by the compiler.
16)what is Collection
17)what is array
Arrays are used to store multiple values in a single
variable, instead of declaring separate variables for each
value.
To declare an array, define the variable type with square
brackets:
21)what is servlet
Ans=servlet used in web application for backend prepose
Servlet based on java technology
23)what is static
Ans= static means if we want to use latest values multiple
times we create object variable not static then multiple
copes will be create .
But variable is static single copes will be create
Whenever if u want use the variable latest value .
Static we can use if we want call variable using class.
24)what is final variable.
Ans=if we don’t want change variable the we use final
variable.
If we don’t want override method then we use static variable.
If wen don’t want extend class then u use final variable .
25)protected access
Ans=protected we can use with a same package and other
package also provided we use inheritance .
j
26)what is garbage collection in java.
Ans=Garbage collection in Java is the process by which Java
programs perform automatic memory management. Java
programs compile to bytecode that can be run on a Java
Virtual Machine, or JVM for short.
27)what is array list…
Ans= array list is the class in java it present it java. Utile
package it have some inbuild method like add,addall,remove
By Using array list, we can add mean type of data add in array
list
In array list duplicate elements also allow.
29)default values
Ans=int= 0,float=0.0,Boolean =false, double=0.00,char=blank,
String=null.
Class loader is a subsystem of JVM which is used to load class files. Whenever we run
the java program, it is loaded first by the classloade
o Inheritance provides code reusability. The derived class does not need to
redefine the method of base class unless it needs to provide the specific
implementation of the method.
o Runtime polymorphism cannot be achieved without using inheritance.
o Runtime polymorphism cannot be achieved without using inheritance.
Since the compile-time errors are better than runtime errors, Java renders compile-
time error if you inherit 2 classes. So whether you have the same method or different,
there will be a compile time error.
1)different between overloading and overriding.
2)hash set difference between in hash set and array list
3)how read rest Api in java program .
4)what is multithreading.
5)different between array list and array.
6)different between global and local variable.