CPSC 1100 Lecture 5: CPSC 1100 Lecture 5 Java

31 views3 pages
8 Feb 2017
School
Course
Professor

Document Summary

Declaration of a class called helloprinter public class helloprinter. Java can only have one public class, which much match file name. Every java application contains a class with a main method. The body of the main method contains statements. A string is a sequence of characters in double quotes. Every statement has to end with a semicolon. 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. To declare a method in a class specify the types of arguments and type of return value. Int result = tally. getvalue(); // sets refult to 2. Instance variables store the data of an object. Instance of a class = object of the class.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions