CMSC132 Exam Test(A+ Graded)
Serializing Objects correct answers An object can be represented as a sequence of bytes that includes the objects data as well as information about the objects type and the types of data stored. Super() correct answers A method call in a sub class constructor invokes the superclass constructor Overloading correct answers Having multiple methods with same name but different signatures in a class Overriding correct answers Overrides the functionality of an existing method but not if it is marked final Inheritance correct answers The process where one object acquires the properties of another Is-A Relationship correct answers Animal is the superclass of Mammals class therefore Mammals _______ Animal Has-A Relationship correct answers Determines whether a certain class _______ certain thing (hint: some sort of relationship between super class and sub class) Downcasting correct answers Superclass to subclass Upcasting correct answers Subclass to superclass - not allowed because it throws an exception Scanner correct answers Breaks input into logical constructs, delimited by whitespace (hint: Some methods include: hasNext(), nextInt(), next(), etc. of the java I/O) Syntax for Scanner correct answers Scanner sc = new Scanner(S) int i = Int() //for int String s = () //for String equals(object obj) using getClass() correct answers Compares memory reference if(obj == this) return true; else if(obj != null && Class() == Class()) Platypus p = (Platypus) obj; return s() && weight == t etc. equals(object obj) using instanceof correct answers Compares memory reference if(obj == this)
Document information
- Uploaded on
- May 29, 2024
- Number of pages
- 6
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers