Flashcards
CSE1030 - general
Cards in this deck (16)
- 1When a simple class is Immutable?a)the fields are all private
b)the fields are public but final
c)there are no public mutators - 2When an Aggregate class is immutable?a)when there are no public non final fields of primitive or immutable type
b)when there are no public mutable type(making it final wont make it immutable)
c)when there are no public mutator
d)all mutable object are defensive copied - 3Why don't String have a copy constructor?Because they are immutable and they don't change after created
- 4Sting s = "Hello" String n = "Hello" What does s == n prints and whyThis prints true because String is a type that enforces one instance per state as saying that for the same content there exist only an object
- 5What's a Singleton?A Singleton is a class that enforces the creation of only one instance
- 6How do we keep track of the number of the objects created in one instance per state?By creating a map
- 7What's an utility class?An utility class has only static fields and static method and only a private constructor to prevent the Java from creating a public default one. A static feature is related to the class not with the instance
- 8What is the difference between the overloaded methods and the overriden methods?The overloaded methods have the same name but different parameters. The overriden methods happen in the child class in inheritance when the child can write its own implementation of the method.
- 9What's the difference between a mutator and an accessor?A mutator is a method that changes the internal field meanwhile an accessor is a method that returns the value of the internal field.
- 10What's an abstract class?An abstract class is a class that declares itself to be abstract and has abstract methods that are not implemented and finish with a semicolon.
- 11Can an abstract class be instatiated?No but we can cast a child to abstract
- 12How many options does a child of the abstract class have?a)he can call itself abstract too and skip the implementation of the method
b)he can implement the method of the abstract class - 13What's an interferance?An interferance is a special type of abstract class that has only one abstract method(but who is not declared abstract) and has no fields or constructors
- 14What's the difference between pass by value and pass by reference?pass by value= only the values of the the arguments are passed(primitives type)
passed by reference = the addresses of the argument are passed(object type) - 15What's an aggregate?An object that has objects as fields
- 16What's the difference between primitive type and object data type?Primitive data type have values. Some methods cannot be used with primitive data types. Object data type contains: state and reference. Also primitive type are passed by value and objects are passed by reference
Information
- Description
- Flashcards on CSE1030 - general, created by Angie Benxhi on 08/04/2014.
- Created by
- Angie Benxhi
- Views
- 23
- Rating