cs211 review

Cards (84)

  • the public modifier is applicable to interfaces, classes, records, fields, and methods
  • public modifier means accessible from any other class or package
  • private modifier is applicable to classes, fields, and methods
  • private modifier means accessible only within the defining class
  • protected modifier is applicable to classes, fields, and methods
  • protected modifier means accessible within the same package or by subclasses even if they are in different classes
  • public static is applicable to interfaces, fields, and methods
  • public static means accessible from any class, but no instance is needed and is shared across all instances
  • public final is applicable to classes, fields, and methods
  • public final means cannot be overridden or changed after the initial assignment and accessible from any class
  • public abstract is applicable to interfaces, classes, and methods
  • public abstract means must be implemented by subclasses, and cannot instantiate directly and has no implementation in the class itself
  • private static is applicable to classes, fields, and method
  • private static means accessible only within the class and is shared across all instances of the class
  • private final is applicable to classes, fields, and methods
  • protected static is applicable to classes, fields, and methods
  • protected static means accessible within the same package or by subclasses, shared across all instances
  • true or false: interface fields are public static by default?
    true
  • protected final is applicable to classes, fields, and methods
  • protected final means cannot be overridden and is accessible within the same package or by subclasses
  • protected abstract is applicable to methods
  • protected abstract means must be implemented by any subclass and is accessible within the same package or by subclass
  • public static final is applicable to classes, fields, and methods
  • public static final represents a global constant that is accessible from anywhere, only one instance exists, and it cannot be changed after assignment
  • private static final is applicable to classes, fields, and methods
  • private static final represents a private constant meaning it is only accessible within the class and cannot be changed after assignment, and. is shared across all instances of the class
  • the static modifier means that there is only one copy of the variable for all class instances. static methods do not need an instance reference to be called
  • final variables can never change value once assigned
  • an interface has no structure and only behaviors
  • abstract classes have structures and behaviors
  • primitive types have no behaviors and only structure
  • a class describes a collection of object with similar responsibilities
  • the new keyword is used to create an instance of a class
  • the void keyword specifies that a method does not return any value
  • null is a value that shows that an object is referring to nothing
  • integer underflow (Integer.MIN_VALUE - 1) causes java to wrap around to the MAX value and continue from there
  • integer overflow causes java to wrap around to the MIN value and continue from there (Integer.MAX_VALUE + 1)
  • the primitive type boolean cannot hold a null value (true or false): true
  • the wrapper class Boolean cannot hold a null value in addition to true or false (true or false): false
  • inheritance is the design mechanism in oop that establishes shared behaviors among classes through a hierarchical relationship (an abstraction that allows objects to share behaviors and be treated polymorphically)