A program is a set of instructions that tells the computer what to do.
In Java, a program consists of one or more classes, where each class can perform different tasks and can tell other classes to perform tasks as well.
The tasks that a class can perform are defined as methods in the class.
The methods are instructions that accomplish the task, possibly by telling other classes to perform subtasks.
The entry point of every Java application is the main()
method.
main()
method of the class you have chosen. main()
method. Even large projects with many different parts and files need an entry point - and that entry point is the main()
method. main()
method. An explanation follows below; don't memorize this.public static void main(String[] args)
main()
Note: You don't have to understand this yet!
public
static
Math.random()
, you don't need to make a new Math
-type object. You can simply call it from the Math
class itself.)void
main
main()
method. Most Java editors are not as forgiving as BlueJ. String[] args
String[]
defines the parameter type, and args
is the name of the parameter. args
, being a name, can technically be named anything you want. Try it!String
s and it's your job to parse the String
s and interpret the meaning of each parameter. Last modified: December 12, 2022
Back to Object Oriented Programming (oop)