CPSC 1100 Lecture 5: CPSC 1100 Lecture 5 Java

18 views3 pages
8 Feb 2017
School
Course
Professor

For unlimited access to Class Notes, a Class+ subscription is required.

9/15
public class HelloPrinter Identifier
{
Public static void main(string[] args)
{
System.out.println(“Hello Printer!”);
}
}
Classes are building blocks of java programs
Declaration of a class called HelloPrinter public class HelloPrinter
Java can only have one public class, which much match file name
Each class contains declarations of methods
Each method contains a sequence of instructions
Every java application contains a class with a main method
The body of the main method contains statements
System.out is object
Println is method
A string is a sequence of characters in double quotes
Every statement has to end with a semicolon
An algorithm is unambiguous, executable, terminating
A variable is used to store a value as a memory location
Comments denoted by //, causes java to ignore all of the rest of the information AFTER the //
Cannot begin a variable with a number, can end with one
Left hand side of = operator must be variable
Methods have () at end
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows page 1 of the document.
Unlock all 3 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+
$10 USD/m
Billed $120 USD annually
Homework Help
Class Notes
Textbook Notes
40 Verified Answers
Study Guides
1 Booster Class
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Class Notes
Textbook Notes
30 Verified Answers
Study Guides
1 Booster Class