Java Intro Flashcards
What is Java?
A high-level, object-oriented programming language designed for minimal implementation dependencies.
What is a key feature of Java that allows it to run on any device?
Platform-Independent: Runs on any device with Java Virtual Machine (JVM).
What does object-oriented mean in the context of Java?
Uses classes and objects to model real-world entities.
What is the basic structure of a Java program?
Arrangement of components including class declaration, main method, and statements.
What is the purpose of ‘public class Main’ in a Java program?
Declares the class. Every program must have at least one class.
What is the entry point of a Java program?
public static void main(String[] args)
What does System.out.println() do in Java?
Prints text to the console.
What is a variable in Java?
Stores changeable data during execution.
What are primitive data types in Java?
Types that define the kind of data, such as:
* int
* double
* char
* boolean
What is an example of a reference data type in Java?
String: Sequence of characters (e.g., ‘Hello, World!’)
What is the difference between declaration and initialization of variables?
Declaration specifies the type and name; initialization assigns a value.
Fill in the blank: To declare an integer variable in Java, use ______.
int x;
What are operators in Java?
Symbols or keywords used to perform operations on variables/values.
List the types of operators in Java.
- Arithmetic Operators
- Comparison Operators
- Logical Operators
What is the purpose of comments in Java?
Non-executable lines for explaining code.