Paypal – Java Interview Questions
Here is the list Java Interview Questions which are recently asked in Paypal company. These questions are included for both Freshers and Experienced professionals.
1. What are the various access specifiers in Java?
Java provides four types of access modifiers or visibility specifiers i.e. default, public, private, and protected. The access modifiers in Java specifies the accessibility or scope of a field, method, constructor, or class.
2. What is the purpose of static methods and variables?
Static variables are used with the class name and the dot operator, since they are associated with a class, not objects of a class. Static methods cannot access or change the values of instance variables, but they can access or change the values of static variables. Static methods cannot call non-static methods.
3. What are the advantages of Packages in Java?
- Java package is used to categorize the classes and interfaces so that they can be easily maintained.
- Java package provides access protection.
- Java package removes naming collision.
4. What is the output of the following Java program?
The output of the Java compiler is bytecode, which leads to the security and portability of the Java code. It is a highly developed set of instructions that are designed to be executed by the Java runtime system known as Java Virtual Machine (JVM).
5. What is object-oriented paradigm?
Object oriented programming (OOP) is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code blueprints which are used to create individual instances of objects.
6. What is an object?
Object is an instance of a class. An object in OOPS is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. For example color name, table, bag, barking.
7. What is the constructor?
A Constructor is a member function which has the same name as its class and is used to initialize the object of that class type with the legal initial value. It is a member function of a class that is called for initializing objects when we create an object of that class.
8. How many types of constructors are used in Java?
There are two types of constructors in Java: no-arg constructor, and parameterized constructor. It is called constructor because it constructs the values at the time of object creation. It is not necessary to write a constructor for a class.
9. What do you understand by copy constructor in Java?
A copy constructor in a Java class is a constructor that creates an object using another object of the same Java class. That's helpful when we want to copy a complex object that has several fields, or when we want to make a deep copy of an existing object.
10. What are the differences between the constructors and methods?
Constructor is used to initialize an object whereas method is used to exhibits functionality of an object. It is invoked implicitly whereas methods are invoked explicitly. It does not return any value where the method may/may not return a value.
11. What is the static variable?
Static variable in Java is variable which belongs to the class and initialized only once at the start of the execution. It is a variable which belongs to the class and not to object. Static variables are initialized only once, at the start of the execution.
12. What is the static method?
Static methods are the methods in Java that can be called without creating an object of class. They are referenced by the class name itself or reference to the Object of that class.
13. What is the Inheritance?
Inheritance is a mechanism in which one class acquires the property of another class. We can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs.
14. Why is Inheritance used in Java?
Inheritance is used for a number of different purposes: to provide subtyping, to reuse code, to allow subclasses to customise superclasses' behaviour or just to categorise objects.
15. Why does Java not support pointers?
Java has a robust security model and disallows pointer arithmetic for the same reason. No pointer support make Java more secure because they point to memory location or used for memory management that loses the security as we use them directly.
TOP MNC's JAVA INTERVIEW QUESTIONS & ANSWERS
Here we listed all Java Interview Questions and Answers which are asked in Top MNCs. Periodically we update this page with recently asked Questions, please do visit our page often and be updated in Java.