Day+1+-+Intro+to+Java
Day+1+-+Intro+to+Java
JAVA
About Java
Development: Java, created by James
Gosling at Sun Microsystems in 1995, is
portable and robust for web and enterprise.
About Java
Development: Java, created by James
Gosling at Sun Microsystems in 1995, is
portable and robust for web and enterprise.
Explanation:
- System.out.println: Tells the computer to display text.
- Parentheses (): Enclose the text to be shown.
- Double Quotes "": Enclose the exact text to be displayed.
- Semicolon ;: Ends the instruction.
Displaying Text On The Screen
Introduction: In Java, you can display text using the
System.out.println command. This command shows the text and 3
moves to a new line.
Explanation:
- System.out.println: Tells the computer to display text.
- Parentheses (): Enclose the text to be shown.
- Double Quotes "": Enclose the exact text to be displayed.
- Semicolon ;: Ends the instruction.
Explanation:
- System.out.println: Tells the computer to display text.
- Parentheses (): Enclose the text to be shown.
- Double Quotes "": Enclose the exact text to be displayed.
- Semicolon ;: Ends the instruction.
Main Method: The main method is the starting point. It tells the computer
where to begin reading instructions, like the first page of an instruction
manual.
Breaking Down Code
Class: A class is like a big box where we keep our instructions. It’s the robot's
instruction manual. We name this box 'MyClass'.
Main Method: The main method is the starting point. It tells the computer
where to begin reading instructions, like the first page of an instruction
manual.
Main Method: The main method is the starting point. It tells the computer
where to begin reading instructions, like the first page of an instruction
manual.
Main Method: The main method is the starting point. It tells the computer
where to begin reading instructions, like the first page of an instruction
manual.
Main Method: The main method is the starting point. It tells the computer
where to begin reading instructions, like the first page of an instruction
manual.
Print Command:
- System.out.println: Command to print text.
- ("Hello, world!"): Text to display.
-; : End of instruction.
Common Printing Errors
Misspelling System.out.println:
Error: System.out.prinln or Systm.out.println
Correct: System.out.println
3
Common Printing Errors
Misspelling System.out.println:
Error: System.out.prinln or Systm.out.println
Correct: System.out.println
Forgetting Semicolons: 3
Error: System.out.println("Hello World")
Correct: System.out.println("Hello World");
Common Printing Errors
Misspelling System.out.println:
Error: System.out.prinln or Systm.out.println
Correct: System.out.println
Forgetting Semicolons: 3
Error: System.out.println("Hello World")
Correct: System.out.println("Hello World");
Forgetting Semicolons: 3
Error: System.out.println("Hello World")
Correct: System.out.println("Hello World");
Forgetting Semicolons: 3
Error: System.out.println("Hello World")
Correct: System.out.println("Hello World");
Forgetting Semicolons: 3
Error: System.out.println("Hello World")
Correct: System.out.println("Hello World");
Example: Search for error: ';' expected with the Java prefix on
Stack Overflow.
Error Solution Using
Stack Overflow
Introducing Stack Overflow: A community for programmers to
3
ask and answer coding questions.
Example: Search for error: ';' expected with the Java prefix on
Stack Overflow.