javaKnowledge

Card Set Information

Author:
puchot
ID:
153232
Filename:
javaKnowledge
Updated:
2012-05-14 21:52:13
Tags:
Java
Folders:

Description:
Java programming terms and concepts (based on the docs.oracle.com tutorials).
Show Answers:

Home > Flashcards > Print Preview

The flashcards below were created by user puchot on FreezingBlue Flashcards. What would you like to do?


  1. Member variables in a class are called _____.
    fields
  2. Variables in a method or block of code are called _____.
    local variables
  3. Variables in method declarations are called _____.
    parameters
  4. 'public' and 'private' are two examples of what?
    Access Modifiers
  5. The Java programming language defines what types of variables?
    • 1. Instance Variables (Non-Static Fields)
    • 2. Class Variables (Static Fields)
    • 3. Local Variables
    • 4. Parameters
  6. Non-static fields are also known as _____, because _____.
    instance variables, because their values are unique to each instance of a class (so, for instance, the weight of once bicycle is never exactly the same as the weight of another).
  7. Non-static fields are declared without what?
    The static keyword.
  8. A class variable is any field declared with what?
    The static modifier.
  9. What does the static modifer tell the compiler about a field? What does the keyword final tell the compiler?
    Static tells the compiler that there is only one copy of this variable in existence -- no matter how many instances of the class there are. So, for the class 'bicycle', all instances would have two wheels. The keyword final tells the compiler that this value will never change.
  10. Which two of the following are not keywords?

    final
    case
    point
    throw
    voids
    enum
    • point
    • voids
  11. There is no special keyword designating a variable as local; that determination comes entirely from the location in which the variable is declared — which is between the opening and closing braces of _____.
    a method
  12. Parameters are always classified as _____ not _____.
    variables, not fields
  13. Variable names are case sensitive. True or false?
    True.
  14. The convention is always to begin your variable names with a _____, not a _____ or a _____.
    The convention is always to begin your variable names with a letter, not a '$' or a '_'.
  15. Which of the variable names below do not follow convention?

    gear
    house_number
    spokeNumber
    firstName
    BrandName
    • house_number -- shouldn't have underscore
    • BrandName -- should be 'brandName'
  16. If your variable stores a constant value, what is the naming convention?
    All caps, words separated by an underscore. The underscore isn't used anywhere else.

    So, an example would be:

    static final int WOOD_CHUCKED = 7
  17. Java is statically typed. What does this mean?
    All variables must be declared before they can be used.
  18. What is a primitive data type?
    A data type that is pre-defined by the language and is named with reserved keyword.
  19. How many primitive data types does Java support? What are they?
    Eight:

    • byte
    • short
    • int
    • long
    • float
    • double
    • boolean
    • char
  20. Which uninitialized field/variable below is not assigned a default value by the compiler?

    Instance Variables
    Class Variables
    Local Variables
    Local Variables
  21. A _____ is a source code representation of a fixed value and does not require computation before being used in your code.
    literal
  22. An integer literal is of the type _____ if it ends with the character _____; otherwise, it is of the type _____.
    An integer literal is of the type Long if it ends with the character 'L' (or 'l' -- though it is recommended you always use the upper case since the lower is easy to mistake for the digit '1'); otherwise, it is of the type int.
  23. What is the prefix used in Java for hexadecimal values? Binary?
    • Hexidecimal prefix: '0x'
    • Binary prefix: '0b'
  24. A floating-point literal is of type _____ if it ends with the letter _____ or _____; otherwise its type is _____ and it can optionally end with the letter _____ or _____.
    A floating-point literal is of type float if it ends with the letter F or f; otherwise its type is double and it can optionally end with the letter D or d.
  25. Always use 'single quotes' for _____ literals and "double quotes" for _____ literals.
    Always use 'single quotes' for char literals and "double quotes" for String literals.
  26. There's a special kind of literal called a class literal, formed by _____. This refers to _____.
    There's a special kind of literal called a class literal, formed by taking a type name and appending ".class"; for example, String.class. This refers to the object (of type Class) that represents the type itself.
  27. After a method throws an exception, the runtime system attempts to find something to handle it. The set of possible "somethings" to handle the exception is the ordered list of methods that had been called to get to the method where the error occurred. The list of methods is known as the _____.
    call stack
  28. What happens when the system can't find an exception handler to catch an exception?
    The runtime system (and, consequently, the program) terminates.
  29. Valid Java programming language code must honor the _____. This means that code that might throw certain exceptions must be enclosed by what?
    Catch or Specify Requirement.

    • This means that code that might thow certain exceptions must be enclosed by either of the following:
    • 1. A "try" statement that catches the exception. The try must provide a dhandler for the exception.
    • 2. A method that specifies that it can throw the exception. The method must provide a throws clause that lists the exception.
  30. What are the three types of exceptions?
    • Checked Exception
    • Error
    • Runtime Exception

What would you like to do?

Home > Flashcards > Print Preview