JAVA Script Lecture 1
- dipeshbakhrel
- Nov 9, 2024
- 1 min read

Goal
Learn enough Java to do something useful Examples:
• Simulate a natural/engineering process
• Manipulate PDFs
• Draw pretty graphics
The Computer
Memory
Central Processing Unit (CPU)
Input/Output (IO) Devices Memory
Programming Languages
• Easier to understand than CPU instructions
• Needs to be translated for the CPU to understand it
Java
• “Most popular” language
• Runs on a “virtual machine” (JVM)
• More complex than some (eg. Python)
• Simpler than others (eg. C++)

First Program
class Hello {
public static void main(String[] arguments) {
// Program execution begins here
System.out.println("Hello world.");
}
}
1.Program Structure
class CLASSNAME {
public static void main(String[] arguments) {
STATEMENTS
}
}
Output
System.out.println(some String) outputs to the console
Example:
System.out.println(“output”);
Second Program
class Hello2 {
public static void main(String[] arguments) {
System.out.println("Hello world."); // Print once
System.out.println("Line number 2"); // Again!
}
}
Types
Kinds of values that can be stored and manipulated.
boolean: Truth value (true or false).
int: Integer (0, 1, -47).
double: Real number (3.14, 1.0, -2.1).
String: Text (“hello”, “example”).
Variables
Named location that stores a value of one particular type.
Form: TYPE NAME;
Example: String foo;
Operators
Symbols that perform simple computations
Assignment: =
Addition: +
Subtraction: -
Multiplication: *
Division: /
Order of Operations Follows standard math rules:
1. Parentheses
2. Multiplication and division
3. Addition and subtraction




Comments