6.178 Lecture Notes - Lecture 4: Object-Oriented Programming, Programming Paradigm, If And Only If

253 views2 pages

Document Summary

A constructor creates an instance of the class. They are called after using the new keyword. They look like other methods but do not specify a return type. They must be named exactly the same as the class. A class can have multiple constructors with different parameters. If you do not initialize an object and try to use it later, you will get a nullpointerexception. Methods that can be called on speci c instances of an object. The opposite of a static method that can be called without an instance of an object. The same access modi ers can be applied to instance methods as elds. Includes the return type and name like any other method. Just like constructors, can have methods with same name and different parameters and/or return type. Use the annotation @override before the method to show that you are changing the behavior of the default. Classes can contain a mix of static and instance methods.

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