[go: up one dir, main page]

0% found this document useful (0 votes)
3 views5 pages

Simple Java Screening Questions

Uploaded by

Manasa P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Simple Java Screening Questions

Uploaded by

Manasa P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Simple Java Interview Questions (For Screening)

1. What is Java?

Java is a high-level, object-oriented programming language used to build applications.

2. What is the JDK?

JDK stands for Java Development Kit. It includes tools for developing and running Java programs.

3. What is the JRE?

JRE stands for Java Runtime Environment. It provides libraries and JVM to run Java applications.

4. What is the JVM?

JVM stands for Java Virtual Machine. It runs Java bytecode and enables platform independence.

5. What are the main features of Java?

Simple, Object-Oriented, Platform Independent, Secure, Robust, Multithreaded.

6. What is a class?

A class is a blueprint for creating objects in Java.

7. What is an object?

An object is an instance of a class that contains state and behavior.

8. What is a constructor?

A constructor is a special method used to initialize objects.

9. What is method overloading?

Method overloading is when multiple methods have the same name but different parameters.

10. What is method overriding?

Method overriding is when a subclass provides a specific implementation of a method from its

superclass.

11. What is inheritance?

Inheritance is when a class acquires properties and methods of another class.


12. What is encapsulation?

Encapsulation is wrapping data and methods into a single unit (class) and restricting access to

details.

13. What is abstraction?

Abstraction means hiding complex implementation details and showing only essential features.

14. What is polymorphism?

Polymorphism allows methods to behave differently based on the object that is calling them.

15. What is an interface?

An interface is a reference type in Java, similar to a class, that contains only abstract methods.

16. What is the difference between == and equals()?

== checks reference equality, equals() checks content equality.

17. What is the difference between Array and ArrayList?

Array is fixed in size and type. ArrayList is resizable and part of the Collections framework.

18. What is the use of the 'final' keyword?

It makes variables, methods, or classes unchangeable or non-overridable.

19. What is the main method in Java?

The entry point of a Java program: public static void main(String[] args).

20. What is exception handling?

A mechanism to handle runtime errors using try, catch, finally, and throw.

21. What is a package?

A package is a namespace that organizes classes and interfaces.

22. What is the 'this' keyword?

'this' refers to the current object of the class.

23. What is a static keyword?


It means the member belongs to the class, not to instances.

24. What is the difference between break and continue?

break exits the loop; continue skips to the next iteration.

25. What is a loop in Java?

A loop is used to execute a block of code repeatedly (for, while, do-while).

26. What is the use of super keyword?

It refers to the parent class and is used to access parent class members.

27. What are access modifiers?

Keywords that define access level: private, default, protected, public.

28. What is garbage collection?

Automatic process to delete unused objects and free memory.

29. What is a try-catch block?

Used to handle exceptions and avoid program crashes.

30. What is the default value of an int in Java?

31. Can a Java class have multiple constructors?

Yes, this is called constructor overloading.

32. What is the difference between String, StringBuilder, and StringBuffer?

String is immutable; StringBuilder is mutable and fast; StringBuffer is mutable and thread-safe.

33. What is a null pointer exception?

It occurs when you try to use an object reference that is null.

34. What is the purpose of the return statement?

It exits from a method and optionally returns a value.

35. What is a variable?


A container that holds data during program execution.

36. What is a data type?

Specifies the type of data a variable can hold (int, char, float, etc.).

37. What is a loop control variable?

A variable that controls how many times a loop runs.

38. What is type casting?

Converting one data type to another.

39. What is a nested class?

A class defined inside another class.

40. What is the difference between public and private?

public members are accessible from anywhere, private only within the class.

41. What is an import statement?

Used to bring other classes or entire packages into a Java class.

42. What are comments in Java?

Notes in code ignored by the compiler: // for single-line, /* */ for multi-line.

43. What is the difference between compile-time and run-time?

Compile-time is when code is converted to bytecode; run-time is when the program runs.

44. What is the use of 'new' keyword?

Used to create new objects.

45. What is a default constructor?

A constructor with no parameters, provided by Java if none is defined.

46. What is a recursive method?

A method that calls itself.

47. What is an IDE?


Integrated Development Environment (e.g., Eclipse, IntelliJ) for coding and testing.

48. What is a logical operator?

Used to combine multiple conditions: &&, ||, !

49. What is a ternary operator?

Shortcut for if-else: condition ? trueResult : falseResult

You might also like