Pergunta de entrevista da empresa EPAM Systems

Q #6) What is meant by the Local variable and the Instance variable? Answer: Local variables are defined in the method and scope of the variables that exist inside the method itself. Instance variable is defined inside the class and outside the method and the scope of the variables exists throughout the class. Q #7) What is a Class? Answer: All Java codes are defined in a Class. It has variables and methods. Variables are attributes which define the state of a class. Methods is a place where the exact business logic has to be done. It contains a set of statements (or) instructions to satisfy the particular requirement. Example: 1 2 3 4 5 6 7 public class Addition{ //Class name declaration int a = 5; //Variable declaration int b= 5; public void add(){ //Method declaration int c = a+b; } } Q #8) What is an Object? Answer: An instance of a class is called an object. The object has state and behavior. Whenever the JVM reads the “new()” keyword then it will create an instance of that class. Example: 1 2 3 4 5 public class Addition{ public static void main(String[] args){ Addion add = new Addition();//Object creation } } The above code creates the object for the Addition class. Q #9)What are the OOPs concepts? Answer: OOPs concepts include: Inheritance Encapsulation Polymorphism Abstraction Interface