Module-01--Interview Question _JAVA
Source: Dev.to
1. How many data types are in Java?
- Primitive Data Types (8 total):
byte,short,int,long,float,double,char,boolean - Non‑Primitive (Reference) Data Types: Classes, Interfaces, Arrays, Enums, etc.
2. What is the default value of char in the data type?
3. What command are you using to compile and run the Java program using the command?
4. What is JDK?
5. What is JRE?
6. Difference between static variable and non‑static variable?
- Non‑static Variable: Each object has its own copy; it belongs to the instance.
7. How to call the static variable and non‑static variable?
8. What is JIT?
9. What is an Object?
- State: The data or information an object holds.
- Behaviour: Defined by the methods inside the class.
10. What is a Class?
- The first letter should be capitalized in the class name.
- Class names may contain special characters such as
$and_. - Numeric values are allowed in the last and intermediary positions of a class name.
11. Can we create the object without a class?
12. Can we create the object without the new keyword?
13. Who will allocate the object memory in the heap?
14. Why do we use the operator in Java?
15. How many types of operators are available in Java?
16. What is a Variable?
17. Why is JDK independent?
18. What is JVM?
19. What are static variables and non‑static variables?
- Non‑static Variable: Each object has its copy; it belongs to the instance.
20. What are local variables and global variables?
21. Is it really an instance variable stored in the heap?
22. What is an operator?
In Java, an operator is a special symbol or keyword used to perform operations such as addition, subtraction, division, etc.
Types of operators
-
Assignment Operators:
= -
Arithmetic Operators:
+,-,*,/,% -
Unary Operators:
++(increment) – pre (++no) and post (no++) forms--(decrement) – pre (--no) and post (no--) forms
-
Equality and Relational Operators:
==,!=,= -
Conditional Operators:
&&(AND),||(OR) -
Operator: Symbol
-
Operand: Value