Java Programming Commands
Class 11 – Computer Science Project File
Prepared by: ____________________
Class & Section: ________________
School: _______________________
Introduction to Java
Java is a high-level, object-oriented programming language developed by Sun Microsystems. It is widely
used for developing desktop applications, web applications, mobile apps, and enterprise systems. Java
follows the principle of 'Write Once, Run Anywhere'.
Structure of a Java Program
A Java program consists of package declaration, class definition, main method, and statements. The
main() method is the entry point of any Java program.
Example: public class Sample { public static void main(String[] args) { [Link]("Hello World"); }
}
Basic Java Commands
[Link]() – Used to print output on the screen.
import – Used to access predefined classes and packages.
class – Used to declare a class.
public, private – Access modifiers.
Data Types in Java
Data Type Size Example
int 4 bytes int a = 10;
float 4 bytes float b = 5.5f;
double 8 bytes double d = 10.55;
char 2 bytes char c = 'A';
boolean 1 bit boolean flag = true;
Operators in Java
Java supports arithmetic, relational, logical, assignment, and unary operators.
Control Statements
if, if-else – Used for decision making.
switch – Used for multiple choices.
for, while, do-while – Looping statements.
Arrays in Java
An array is a collection of similar data types stored at contiguous memory locations.
Classes and Objects
A class is a blueprint of an object. An object is an instance of a class.
Conclusion
Java is a powerful and versatile programming language. Understanding basic Java commands helps
students build a strong foundation in programming.