1. What is a Programming Language?
A programming language is a set of instructions, rules, and syntax used to communicate with
computers and create software applications. It allows developers to write code to perform specific
tasks and solve problems. Examples include Python, Java, C++, and JavaScript.
2. Why do we need a programming language?
To give precise instructions to computers for executing tasks.
To build software applications, websites, games, and system utilities.
To automate repetitive or complex processes.
To analyze data and create algorithms for solving real-world problems.
3. What are the features of Java?
Object-Oriented: Follows OOP principles like inheritance, encapsulation, and polymorphism.
Platform-Independent: Java programs run on any platform using the Java Virtual Machine (JVM).
Simple and Secure: Syntax is straightforward, and it provides security features like bytecode
verification.
Robust: Handles errors efficiently and supports strong memory management.
Multithreaded: Allows multiple threads to run simultaneously, improving performance.
High Performance: JIT (Just-In-Time) compiler enhances execution speed.
Distributed and Networked: Facilitates networking and distributed computing.
4. What is an Object?
An object is an instance of a class and represents a real-world entity. It contains:
State: Defined by attributes (fields).
Behavior: Defined by methods.
For example, a "Car" object might have attributes like "color" and "model" and behaviors like "drive"
and "stop."
5. What is a Class?
A class is a blueprint or template for creating objects. It defines the properties (attributes) and
behaviors (methods) that the objects created from it will have.
Example:
java
Copy code
class Car {
String color; // Attribute
void drive() { // Behavior
[Link]("The car is driving");
6. Explain about the main() method in Java.
The main() method is the entry point of any Java application. It is where the program execution
starts.
Syntax:
java
Copy code
public static void main(String[] args) {
// Code to be executed
Explanation:
public: Accessible from anywhere.
static: Belongs to the class, no instance is needed to invoke it.
void: Does not return any value.
String[] args: Array of string arguments passed during runtime.