ITEC 2610 Chapter 1: Basics of Java

172 views3 pages

Document Summary

An object is an instance of a class. >> local variables: defined inside methods, constructors or blocks. Variables are destroyed when the method is complete. >>instance variables: within a class but outside any method. >>class variables: declared within a class, outside any method, with the static keyboard. Class: can be defined as a template/blueprint that describes the behavior/ state that the object of its type supports. >>>constructors have the same name as the class. >>>a constructor is invoked when a new object is created. It is in methods where the logics are written, data is manipulated and all the actions are executed. >>declaration: a variable declaration with a variable name and with an object type. >>instantiation: the new keyword is used to create the object. >>initialization: the new keyword is followed by a call to a constructor. Example: public class puppy { public static void main(string [] args) { //the following is creating a new object mypuppy.

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