Open Eclipse
1. Create a new java project
File menu - New - Java Project
Give it a name - Java projects start with a capital letter
Click finish
If you do not see the project explorer (shows all your projects) on the left, just click
on the window menu - Show view - project explorer
Find the newly created project on the project explorer
2. Create a new package (i.e., folder)
Shortcut in creating a new project is by using the tool bar on the top left, click on
the pool down and click on the java project
Right click on your newly created project then new then package
Java package starts with a small letter by java convention (rules)
Write a package name and click finish
3. Create java class
The programs in java are called class
Shortcut in creating a package is in the tool bar is the brown square icon
After creating your package, save the class in the newly created package
Shortcut in creating a class is in the tool bar in the far-left corner on the top
By convention, class names start with a capital letter and the first letter of every
word is also capital letter
Click the C green icon on the tool bar in creating class
After typing the name, click the first check box and that is it
You may delete the comments
Application Programming Interface (API)
Java API (Java Libraries)
packages
^
|
classes
^
|
methods
public - to communicate with other classes or each other
private - you cannot use it or it cannot function fully
if that class is inside a class
if this is a standalone class it should be public
create a class by declaring this
if you want to run the class there must be at least one method
if there is only one it must be the main method
if there is no main method it can’t run
if you delete the access modifier the selection can’t be launched
if you remove public access modifier, java was not able to find it because it is not
public
who was looking for it? it is the compiler who was looking for the main method
you should declare it public if you want the compiler to find it
static means this task doesn’t have an object
object is an advanced topic
static means the compiler can call the main method even without creating an object
this main method appears when you check the first check box (public static void)
(public) (static) (void) are key words
void is a method is part of a class, and a method is doing something, it’s like a
teacher trying to explain something, if somebody tells to teach, it will teach, but it
doesn’t return anything to the caller
your family won’t go anywhere if you don’t tell so
the compiler calls the main method, the compiler does it job
when a method is void, after doing its job, it will not give back something to the
caller in return, or in other words, it stops
a method must be inside a class, it cannot be outside
if it is followed by a pair of parentheses, it is a method name
every method name is followed by a pair of parentheses ()
the method name is main, if you find something inside the parentheses, that is
called the arguments
it is an advanced topic
just check the first check box to display the main method automatically
system java api
System is the class
out is the name of the constant
out if you want to print something
System.out.print()
go to mic channel go to files you will see another folder recordings
create a new class to display this