CSCI 1112 Lecture Notes - Lecture 1: Dynamic Array, Boolean Expression, Standard Streams

42 views6 pages
17 Jan 2017
School
Course

Document Summary

Java basics: java is an object-oriented programming language, all code is written inside java classes, a class consists of a set of variables (properties) and methods (actions) Classes and objects: a class is a blueprint from which objects are created, an object is conceptually similar to real world objects. An object has a state and behavior. Behavior: switch on/off: states are implemented as fields, a java object is an instance of a java class, several objects can be created from the same class. Java methods modifier returntype methodname(arguments) { method body: example method: public string getsometext(){ retur(cid:374) (cid:862)this is o(cid:373)e te(cid:454)t(cid:863); Getters and setters public string getcolor(){ return color; public void setcolor(string newcolor){ color = newcolor; Constructors: constructors are called when you create a new object from a class, allows you to initialize the object with certain values, constructors look like methods, except: The constructor name is the class name.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions