CSCB07H3 Study Guide - Midterm Guide: Type System, Version Control, Static Variable

274 views2 pages
29 Oct 2015
School
Course

Document Summary

Test version control scenario marked by orange sticker! Two integer objects with same value are not the same (integer1 != integer2), but. Integer1. equal(integer2) is true because . equal method compares int value within integer objects. Two strings are created only if two new string lines are executed! How to create a new array: string [] somestringarray = new string [] { a , ab , abc } (using an array initializer) 1) to print an array, cannot just use built-in print method -> will print the address instead of contend! 2) can only contain objects of same type. How to create a new arraylist: arraylist somearraylist = new arraylist<>(); Static variable: doesn"t belong to any object, it belongs to the class itself. 1) it can only be called through the class, not an object of the class. 2) casting up is safe: children have all functions and properties of their parent. 4) a overriding method in class cannot be casted.