Save
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Java Chapter 1

Declarations and Access Control

TermDefinition
Identifiers (Objective 1.3) can begin with a letter, an underscore, or a currency character
Identifiers (Objective 1.3) After the first character, identifiers can also include digits.
Identifiers (Objective 1.3) can be of any length
Identifiers (Objective 1.3) JavaBeans methods must be named using camelCase, and depending on the method's purpose, must start with set, get, is, add, or remove.
Declaration Rules (Objective 1.1) A source code file can have only one public class.
Declaration Rules (Objective 1.1) If the source file contains a public class, the filename must match the public class name.
Declaration Rules (Objective 1.1) A file can have only one package statement, but multiple imports.
Declaration Rules (Objective 1.1) The package statement (if any) must be the first (non-comment) line in a source file.
Declaration Rules (Objective 1.1) The import statements (if any) must come after the package and before the class declaration.
Declaration Rules (Objective 1.1) If there is no package statement, import statements must be the first (noncomment) statements in the source file.
Declaration Rules (Objective 1.1) package and import statements apply to all classes in the file.
Declaration Rules (Objective 1.1) A file can have more than one nonpublic class.
Declaration Rules (Objective 1.1) Files with no public classes have no naming restrictions.
Class Access Modifiers (Objective 1.1) There are three access modifiers: public, protected, and private.
Class Access Modifiers (Objective 1.1) There are four access levels: public, protected, default, and private.
Class Access Modifiers (Objective 1.1) Classes can have only public or default access.
Class Access Modifiers (Objective 1.1) A class with default access can be seen only by classes within the same package.
Class Access Modifiers (Objective 1.1) A class with public access can be seen by all classes from all packages.
Class Access Modifiers (Objective 1.1) Class visibility revolves around whether code in one class can Create an instance of another class Extend (or subclass), another class Access methods and variables of another class
Class Modifiers (Nonaccess) (Objective 1.2) Classes can also be modified with final, abstract, or strictfp.
Class Modifiers (Nonaccess) (Objective 1.2) A class cannot be both final and abstract.
Class Modifiers (Nonaccess) (Objective 1.2) A final class cannot be subclassed.
Class Modifiers (Nonaccess) (Objective 1.2) An abstract class cannot be instantiated.
Class Modifiers (Nonaccess) (Objective 1.2) A single abstract method in a class means the whole class must be abstract.
Class Modifiers (Nonaccess) (Objective 1.2) An abstract class can have both abstract and nonabstract methods.
Class Modifiers (Nonaccess) (Objective 1.2) The first concrete class to extend an abstract class must implement all of its abstract methods.
Interface Implementation (Objective 1.2) Interfaces are contracts for what a class can do, but they say nothing about the way in which the class must do it.
Interface Implementation (Objective 1.2) Interfaces can be implemented by any class, from any inheritance tree.
Interface Implementation (Objective 1.2) An interface is like a 100-percent abstract class, and is implicitly abstract whether you type the abstract modifier in the declaration or not.
Interface Implementation (Objective 1.2) An interface can have only abstract methods, no concrete methods allowed.
Interface Implementation (Objective 1.2) Interface methods are by default public and abstract—explicit declaration of these modifiers is optional.
Interface Implementation (Objective 1.2) Interfaces can have constants, which are always implicitly public, static, and final.
Interface Implementation (Objective 1.2) Interface constant declarations of public, static, and final are optional in any combination.
Interface Implementation (Objective 1.2) A legal nonabstract implementing class has the following properties: It provides concrete implementations for the interface's methods. It must follow all legal override rules for the methods it implements.
Interface Implementation (Objective 1.2) must not declare any new checked exceptions for an implementation method. It must not declare any checked exceptions that are broader than the exceptions declared in the interface method
Interface Implementation (Objective 1.2) It may declare runtime exceptions on any interface method implementation regardless of the interface declaration. It must maintain the exact signature (allowing for covariant returns) and return type of the methods it implements
Interface Implementation (Objective 1.2) A class implementing an interface can itself be abstract.
Interface Implementation (Objective 1.2) An abstract implementing class does not have to implement the interface methods (but the first concrete subclass must).
Interface Implementation (Objective 1.2) A class can extend only one class (no multiple inheritance), but it can implement many interfaces.
Interface Implementation (Objective 1.2) Interfaces can extend one or more other interfaces.
Interface Implementation (Objective 1.2) Interfaces cannot extend a class, or implement a class or interface.
Interface Implementation (Objective 1.2) When taking the exam, verify that interface and class declarations are legal before verifying other code logic.
Member Access Modifiers (Objectives 1.3 and 1.4) Methods and instance (nonlocal) variables are known as "members."
Member Access Modifiers (Objectives 1.3 and 1.4) Members can use all four access levels: public, protected, default, private.
Member Access Modifiers (Objectives 1.3 and 1.4) Member access comes in two forms: Code in one class can access a member of another class. A subclass can inherit a member of its superclass.
Member Access Modifiers (Objectives 1.3 and 1.4) If a class cannot be accessed, its members cannot be accessed.
Member Access Modifiers (Objectives 1.3 and 1.4) Determine class visibility before determining member visibility.
Member Access Modifiers (Objectives 1.3 and 1.4) public members can be accessed by all other classes, even in other packages.
Member Access Modifiers (Objectives 1.3 and 1.4) If a superclass member is public, the subclass inherits it—regardless of package.
Member Access Modifiers (Objectives 1.3 and 1.4) Members accessed without the dot operator (.) must belong to the same class.
Member Access Modifiers (Objectives 1.3 and 1.4) this. always refers to the currently executing object.
Member Access Modifiers (Objectives 1.3 and 1.4) this.aMethod() is the same as just invoking aMethod().
Member Access Modifiers (Objectives 1.3 and 1.4) private members can be accessed only by code in the same class.
Member Access Modifiers (Objectives 1.3 and 1.4) private members are not visible to subclasses, so private members cannot be inherited.
Member Access Modifiers (Objectives 1.3 and 1.4) Default and protected members differ only when subclasses are involved: Default members can be accessed only by classes in the same package.
Member Access Modifiers (Objectives 1.3 and 1.4 protected members can be accessed by other classes in the same package, plus subclasses regardless of package.
Member Access Modifiers (Objectives 1.3 and 1.4 protected = package plus kids (kids meaning subclasses).
Member Access Modifiers (Objectives 1.3 and 1.4 For subclasses outside the package, the protected member can be accessed only through inheritance;
Member Access Modifiers (Objectives 1.3 and 1.4 a subclass outside the package cannot access a protected member by using a reference to a superclass instance (in other words, inheritance is the only mechanism for a subclass outside the package to access a protected member of its superclass).
Member Access Modifiers (Objectives 1.3 and 1.4 A protected member inherited by a subclass from another package is not accessible to any other class in the subclass package, except for the subclass' own subclasses.
Local Variables (Objective 1.3) Local (method, automatic, or stack) variable declarations cannot have access modifiers.
Local Variables (Objective 1.3) final is the only modifier available to local variables.
Local Variables (Objective 1.3) Local variables don't get default values, so they must be initialized before use.
Other Modifiers—Members (Objective 1.3) final methods cannot be overridden in a subclass.
Other Modifiers—Members (Objective 1.3) abstract methods are declared, with a signature, a return type, and a n optional throws clause, but are not implemented.
Other Modifiers—Members (Objective 1.3) abstract methods end in a semicolon—no curly braces.
Other Modifiers—Members (Objective 1.3) Three ways to spot a non-abstract method: The method is not marked abstract. The method has curly braces. The method has code between the curly braces.
Other Modifiers—Members (Objective 1.3) he first nonabstract (concrete) class to extend an abstract class must implement all of the abstract class' abstract methods.
Other Modifiers—Members (Objective 1.3) The synchronized modifier applies only to methods and code blocks.
Other Modifiers—Members (Objective 1.3) synchronized methods can have any access control and can also be marked final.
Other Modifiers—Members (Objective 1.3) abstract methods must be implemented by a subclass, so they must be inheritable. abstract methods cannot be private. abstract methods cannot be final.
Other Modifiers—Members (Objective 1.3) The native modifier applies only to methods.
Other Modifiers—Members (Objective 1.3) The strictfp modifier applies only to classes and methods.
Methods with var-args (Objective 1.4) As of Java 5, methods can declare a parameter that accepts from zero to many arguments, a so-called var-arg method.
Methods with var-args (Objective 1.4) A var-arg parameter is declared with the syntax type... name; for instance: doStuff(int... x) { }
Methods with var-args (Objective 1.4) A var-arg method can have only one var-arg parameter.
Methods with var-args (Objective 1.4) In methods with normal parameters and a var-arg, the var-arg must come last.
Variable Declarations (Objective 1.3) Instance variables can Have any access control Be marked final or transient
Variable Declarations (Objective 1.3) Instance variables can't be abstract, synchronized, native, or strictfp.
Variable Declarations (Objective 1.3) It is legal to declare a local variable with the same name as an instance variable; this is called "shadowing."
Variable Declarations (Objective 1.3) final variables cannot be reinitialized once assigned a value.
Variable Declarations (Objective 1.3) final reference variables cannot refer to a different object once the object has been assigned to the final variable.
Variable Declarations (Objective 1.3) final reference variables must be initialized before the constructor completes.
Variable Declarations (Objective 1.3) There is no such thing as a final object. An object reference marked final does not mean the object itself is immutable.
Variable Declarations (Objective 1.3) The transient modifier applies only to instance variables.
Variable Declarations (Objective 1.3) The volatile modifier applies only to instance variables.
Array Declarations (Objective 1.3) Arrays can hold primitives or objects, but the array itself is always an object.
Array Declarations (Objective 1.3) When you declare an array, the brackets can be to the left or right of the variable name.
Array Declarations (Objective 1.3) It is never legal to include the size of an array in the declaration.
Array Declarations (Objective 1.3) An array of objects can hold any object that passes the IS-A (or instanceof) test for the declared type of the array. For example, if Horse extends Animal, then a Horse object can go into an Animal array.
Static Variables and Methods (Objective 1.4) They are not tied to any particular instance of a class.
Static Variables and Methods (Objective 1.4) No classes instances are needed in order to use static members of the class.
Static Variables and Methods (Objective 1.4) There is only one copy of a static variable / class and all instances share it.
Static Variables and Methods (Objective 1.4) static methods do not have direct access to non-static members.
Enums (Objective 1.3) An enum specifies a list of constant values assigned to a type.
Enums (Objective 1.3) An enum is NOT a String or an int; an enum constant's type is the enum type. For example, SUMMER and FALL are of the enum type Season.
Enums (Objective 1.3) An enum can be declared outside or inside a class, but NOT in a method.
Enums (Objective 1.3) An enum declared outside a class must NOT be marked static, final, abstract, protected, or private.
Enums (Objective 1.3) Enums can contain constructors, methods, variables, and constant class bo dies.
Enums (Objective 1.3) enum constants can send arguments to the enum constructor, using the syntax BIG(8), where the int literal 8 is passed to the enum constructor.
Enums (Objective 1.3) enum constructors can have arguments, and can be overloaded.
Enums (Objective 1.3) enum constructors can NEVER be invoked directly in code. They are always called automatically when an enum is initialized.
Enums (Objective 1.3) The semicolon at the end of an enum declaration is optional. These are legal: enum Foo { ONE, TWO, THREE} enum Foo { ONE, TWO, THREE};
Enums (Objective 1.3) MyEnum.values() returns an array of MyEnum's values.
Created by: martira06
Popular Standardized Tests sets

 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards