• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/24

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

24 Cards in this Set

  • Front
  • Back

How many public classes are allowed per source code file?

1

What are the legal identifier rules?

Must start with letter, currency char, or an underscore. After first char, can contain any combo of letters, numbers, currency char, or underscore Cannot use a keyword Are case sensitive

What are identifiers?

Names for variables, methods, and classes

How many public classes can a source code file contain?

1

True or False: If there is a public class in the file, the name of the file must match the name of the public class.

True

What is the order of code in a file that has a class declaration, import statements, and package statements?

1. Package


2. Import


3. Class Declaration

What is the method the JVM uses to start execution of a Java program?

public static void main(String[] args)

What are the Java access modifiers?

public


protected


private

What are the Java access control?

default (package)


protected


private


public

What are the nonaccess class modifiers?

abstract


final


strictfp

What is the strictfp nonaccess modifier used for?

To signify that the method or class conforms to the IEEE 754 standard rules for floating points. Cannot be used on a variable.

What does final mean in a class declaration?

It locks the class down against being subclassed. This should only be used if you need to guarantee that none of the methods in that class will ever be overriden.

What does the abstract nonaccess modifier do to a class?

It sets it so that the class can never be instantiated. This is used when the purpose of the class is to be extended. If one method is abtract, then the entire class must be labeled abstract.

True or false: A class be final and abstract.

False

What is an interface?

A contract for what a class can do.

How many classes can a class extend?

1

How many interfaces can a class implemtn?

None to many

All java objects are a subclass of what class?

The object class

Can static methods be overriden?

No.

True or false: calling super.super.methodName() would invoke the superclass of an object's superclass?

False. You can only use super to access a method in a class' superclass.

What is overloading vs overriding a method?

Overloading is creating more versions of a method with a different argument list but reusing the same method name.




Overriding is reimplenting the method code to define behavior more specific to the class.

What are the rules for overloading?

-Must change the argument list


-Can change the return type


-Can change the access modifier


-Can declare new or broader exceptions

What are the rules for overwriting?

-Must keep argument list the same


-Must keep return type the same or a subtype of the original return type


-Can't have a more restrictive access level


-Can have a less restrictive access level


-Cannot throw new or broader exceptions


-Cannot be overridden if static, final or if not inherited due to acess modifiers

Can you upcast objects in the same inheritance tree without an explicit cast?

Yes, because you're going to a more general version which won't