JAVA
JAVA
JDK is the best for developing for JAVA programs. To get it is necessary to go to Oracle website:
Oracle JDK and Netbean bundle.
Once the program is installed is necessary to go to File > New Project > Select Java and Select java
application and then press Next. > Create name for the project.
To the type of code. Inside the Package NAME > PUBLIC CLASS NAME > Public static void main
(System.out.println(“Hello World”) ; ) and then RUN
To import the packages to the program: Import mypackage1; -Single member of the package.
Import mypackage.*; - will import all the member of the package
Basic Operators
Operator Description Example
= Assignment Assign values int userAge = 21;
+ (Plus) Add values x=3;y=4; x+y = 7;
- (Minus) Subtracts values x=3;y=4; y-x=1;
*(Multiplication) Multiplies values x=3;y=4; x*y=12;
/ (Division) Divides values x=8;y=4; x/y=2;
% (Modulus) Returns remainder x=8;y=5; x% y=1.6;
+= (Add & Combines operators x=3;y=4; x+=2; x=x+2;
Assignment)
++ (incremental) Increases value x=3; x++; x become 4
== (equal to) Checks if values are x =3;y=3; x==y;
equal
!= (not equal to) Checks if value is not x=3; y=4; x !==y;
equal
> (Greater than) Checks if the value is x=4; y=3; x > y;
greater
< (Less than) Checks if value is less x=3; y=4; x < y;
>= (Greater than or Check if value is x=3; y=4; y >=x;
equal) greater or equal
<= (Less than or Checks if value is less x=4; y=7; x<=y;
equal) or equal
NOTE: to save and share with others it is necessary to press RUN on the top menu bar and choose
the option Clean and Build Project (Number Addiction).
A class can be either private or public, if the class is public it means that it can be accessed by
anybody, if the class is private it means it can only be accessed by other classes within the same
classes.
Terminar Excell
Terminar Java
Desenhar a noite
IMPORTING PACKAGES
Java.awt package Is used to create, it has all the
classes to create the user interfaces.
Things to be used in application,
button, scroll bar and etc.
Java.awt.FlowLayout Is used to arrange components in the direction
of flow. More like the lines of a text in
paragraph.
Java.awt.Font Allows us to specify the type of the font, size,
the family and etc.
Java.awt.Color This allows us the use different properties for
the colour
Javax.swing package Is used for java standard extensions.
Seeing is a set of program
components. It allows to create GUI
= graphical user interfaces.
Javax.swingJFrame This is a class, is a window that has a
decoration, a title, button components that
can close, and icon for the window and so on.
Javax.swing.JLabel This is the display area for text or image.
NOTE: extends JFrame = means we are extend the subclass of the class I am extending.