CSE 219 Lecture Notes - Lecture 1: Multiple Inheritance, Covariance

64 views2 pages

Document Summary

Not everything in java is an object-- primitive types are not objects: short, int, long, float, char, boolean, double, byte. Can only inherit from a single class. By default, a class that does not explicitly inherit a class implements the object class. You can access a super class by using the super keyword i. e. super(age) You don"t need to use the super keyword when using inherited methods, assuming that the method is not overridden. You can override an inherited method- just redefine the class. It is good practice to annotate code the new method. When you override something, you should put @override in the line before. @override public double getage() { return super. getage() - 10; When two methods have the same name, but have different signatures/arguments. Public double add( double arg1, double arg2 ) Public double add( double arg1, double arg2, double3 ) When overriding a method, the entire signature must be the same.

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