Java Interview Question Answers List:
Q: What is Java?
Java is an object-oriented programming language. Java language was developed by James Gosling at Sun Microsystems Inc.Java can be used as the server-side language. Furthermore, it can be also used for big data and Android development. Java is also commonly used for desktop computing, other mobile computing, games, and numerical computing
Q: What is data type in Java?
Data types are used to define the size and the type of value a variable can store. There are various types of data types available in Java which are divided into two categories.
- Primitive data types
- Non-primitive data types
Q: What is the difference between primitive and non-primitive data types?
Primitive data types are those which are predefined but on the other hand, no primitive data types are defined by the programmer. Furthermore, non-primitive types can be null but primitive types always has a value. Available primitive data types in java are boolean, char, byte, short, int, long, float and double and non-primitive data types are Classes, Interfaces, and Arrays.
Q: What is a Variable?
A variable is the name of the memory location and a variable is used to store some value while the execution of the Java program. As we know java is a strongly typed language so it is compulsory to mention the data type of variable while defining it.
Q: What are the types of variables in Java?
There are three types of variables in Java.
- local variables
- instance(also known as global variables)
- static variables