0
0
Javaprogramming~5 mins

Writing first Java program - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the basic structure of a Java program?
A Java program has a class with a <code>main</code> method inside. The <code>main</code> method is where the program starts running.
Click to reveal answer
beginner
What does System.out.println() do in Java?
It prints text or values to the screen and moves to the next line, so you can see output from your program.
Click to reveal answer
beginner
Why do we need the public static void main(String[] args) method?
This method is the entry point of any Java program. The computer looks for it to start running your code.
Click to reveal answer
beginner
What is a class in Java?
A class is like a blueprint or a container that holds code. Every Java program needs at least one class.
Click to reveal answer
beginner
How do you save and run a Java program?
Save the file with a .java extension and the same name as the class. Then use javac to compile and java to run it.
Click to reveal answer
What keyword starts the main method in a Java program?
Apublic
Bstart
Cbegin
Dmain
Which method prints text to the console in Java?
ASystem.out.print()
Bprint()
CSystem.out.println()
Dconsole.log()
What file extension should a Java source file have?
A.exe
B.java
C.class
D.txt
What is the name of the method where Java starts running your program?
Amain()
Brun()
Cstart()
Dinit()
Which command compiles a Java program?
Arunjava
Bjava
Ccompile
Djavac
Explain the role of the main method in a Java program.
Think about where the computer looks first to run your code.
You got /3 concepts.
    Describe the steps to write, save, compile, and run a simple Java program.
    Consider the full process from typing code to seeing output.
    You got /4 concepts.