0% found this document useful (0 votes)
7 views

Gr10 It Java Notes

The document provides an overview of Java, a programming language used for various applications including mobile and web development. It explains key concepts such as the main method, classes, compilation, syntax, and Object-Oriented Programming (OOP). Additionally, it highlights the importance of proper formatting and structure in Java code.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Gr10 It Java Notes

The document provides an overview of Java, a programming language used for various applications including mobile and web development. It explains key concepts such as the main method, classes, compilation, syntax, and Object-Oriented Programming (OOP). Additionally, it highlights the importance of proper formatting and structure in Java code.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Term 2 Notes

GRADE 10 INFORMATION TECHNOLOGY (Practical)

What is Java?
Java is a popular programming language, created in 1995. It is used for:

 Mobile applications (especially Android apps)


 Desktop applications
 Web applications
 Web servers and application servers
 Games
 Database connection
 And much more!

Also
 Java is a stand-alone application that can run on computers and laptops
 Java programs are created in an IDE (Integrated Development Environment)
like NetBeans
 Java files/programs are saved with a .jar extension

Main method

 A Java program that can be run must have a main method, which is the
starting point of a program. The main method is enclosed in curly brackets. It
always has the heading:
Public static void main (String [] args)

Classes

 A Java program consists out of one or more classes - a class is a template


from which objects can be created
 Java is case sensitive - every class must have a name starting with a Capital
letter, without spaces between words. MakeSquare
 The body of the class is enclosed in curly brackets {}

Remember that every Java program has a class name which must match the
filename, and that every program must contain the main() method.
Term 2 Notes

Compile and Run

 Compile: This means converting your Java code into a form the computer can
understand (called bytecode). The compiler checks for errors too.
 Run: This means actually executing the program so it does what you told it to
do — like showing a message or doing a calculation.
 First you compile the code, then you run it.

Syntax and Formats

 The double forward slash and colon //: is used in Java mainly for
comments

//: Is for a single line comment

// Sample comment

/* ... */: Is for a multi-lined comment

/* This is a
multi-line comment */

 Curly brackets { } group code together, like the body of a class, method, or
loop. It is used to show the beginning and end of blocks of code. The actual
instructions to be carried out is within curly brackets
 Indents: Make code easier to read by showing which code is inside a block
(like inside { }).
 Blank lines: Add spacing to make the code more readable and organized.
They don’t change how the code works, but they help people understand it
better.

Statements

 Statements are instructions telling the program what to do. All statements
end with a semi-colon;

Gogga bug = new Gogga ();

OOP
Term 2 Notes

Java programs use objects which have properties. Code can be created to
determine the behaviour of an object by using its properties. This is called
Object-Orientated Programming (OOP)

Properties of an object are stored in fields. Fields are also called variables.

Tehe actions an object can carry out are called methods. Method names are
always followed with an open and close round bracket ()

You might also like