Classes, Data Types, and OOP
Concepts
What defines a class in Java? - 🧠 ANSWER ✔✔A class is a
blueprint/template for creating objects.
What is the basic structure of a Java class? - 🧠 ANSWER ✔✔class
HelloWorld { public static void main(String args[]) {
System.out.println("Hello World"); } }
What does the 'public' access modifier indicate? - 🧠 ANSWER ✔✔It makes
the main method accessible as part of the public interface of the program.
, Why is the main method declared as 'static'? - 🧠 ANSWER ✔✔It must be
called before any instance of the class is created.
What does 'void' signify in a method declaration? - 🧠 ANSWER ✔✔It
indicates that the method does not return any value.
What is the purpose of 'String args' in the main method? - 🧠 ANSWER ✔✔It
is used to accept command-line arguments.
What does 'System.out.println()' do? - 🧠 ANSWER ✔✔It prints text to the
console.
What are identifiers in Java? - 🧠 ANSWER ✔✔Identifiers are names given
by the programmer for variables, methods, classes, etc.
What is the syntax for variable declaration in Java? - 🧠 ANSWER
✔✔<datatype> <varName>; [= value;]
What is a Java Wrapper Class? - 🧠 ANSWER ✔✔It is used to convert one
data type into another and to wrap primitive values into objects.
What is the Java 2 Software Development Kit (JDK)? - 🧠 ANSWER ✔✔It
contains tools like java (loader), javac (compiler), and javadoc
(documentation generator).