CPS 109 Lecture Notes - Lecture 1: Primitive Data Type, Default Constructor, Java Bytecode
Document Summary
Objects are not written directly in java: classes are a blueprint of an object, class compiles java bytecode. Public void methodname naming convention: void = no return type, methodname lowercase always. Methods contain statements: instructions for an object. Method call: object. methodname(arguments); always put arguments except in some void methods, then use empty parentheses eg where the method just prints out using system. out. println nothing is passed into it. Whitespace in java: compiler is insensitive to it, so it is skipped over. Case-sensitivity: compiler is case-sensitive, reads lowercase and uppercase as separate. A class declaration for a subclass, can be done using extends . Eg: public class mountainbike extends bicycle{ : here mountainbike inherits all fields and methods of bicycle + has its own fields. & methods: *a class can only extend/subclass 1 parent, *a class can implement more than 1 interface*