Java Ch. 2

  1. // or Double Dash:
    Marks the beginning of a comment.
  2. ( ) or Opening and Closing parenthesis:
    Used in a Method Header.
  3. { } or Opening and Closing braces:
    Encloses a group of statements, such as the contents of a Class or a Method.
  4. " " or Quotation Marks:
    Encloses a string of characters, such as a message that is to be printed on the screen.
  5. ; or Semicolon:
    Marks the end of a complete programming statement.
  6. All Java source code filenames must end with:
    a .java extension.
  7. Every Java application program must have:
    a method named main.
  8. Java is a case-sensitive language, it:
    DOES NOT regard uppercase letters as being the same as their lowercase equivalents.
  9. All Java programs must be stored in a file with a name:
    that ends with .java.
  10. Comments are ignored by:
    the compiler.
  11. A .java file may contain many classes but may only have:
    one public class that must have the same name as the file.
  12. Statements are terminated with semicolons, this does not include:
    comments, class headers, method headers, or braces.
  13. API stands for:
    Application Programmer Interface.
  14. The API is:
    a standard library of prewritten classes for performing specific operations.
  15. \n or Newline:
    Advances the cursor to the next line for subsequent printing.
  16. \t or Horizontal tab:
    Causes the cursor to skip over to the next tab stop.
  17. \b or Backspace:
    Causes the cursor to back up, or move left, one position.
  18. \r or Return:
    Causes the cursor to go to the beginning of the current line, NOT the next line.
  19. \\ or Backslash:
    Causes a backslash to be printed.
  20. \' or Single Quote:
    Causes a single quotation mark to be printed.
  21. \" or Double Quote:
    Causes a double quotation mark to be printed.
  22. A Variable is:
    A named storage location in the computer's memory,
  23. A Literal is:
    A value that is written into the code of a program commonly assigned to variables or displayed.
  24. A Variable Declaration or Name:
    tells the computer the variable's name and the type of data it will hold.
  25. An Identifier is:
    A programmer-defined name that represents some element of a program (i.e. variable names and class names).
  26. Key Words are:
    words that have a special meaning in the programming language and used for their intended purpose only. Key Words are also known as Reserved Words.
  27. Specific rules for Identifiers:
    • -first character must be a-z, A-Z, underscore, or a dollar sign.
    • -after first character, you may use a-z, A-Z, 0-9, underscores, or dollar signs.
    • -upper and lowercase character are distinct.
    • -cannot include spaces.
  28. Data Types and Size:
    • byte = 1 byte
    • short = 2 bytes
    • int = 4 bytes
    • long = 8 bytes
    • float = 4 bytes
    • double = 8 bytes
  29. Data Types are called "primitive" because you cannot:
    use them to create objects.
  30. Primitive Data Types can only create:
    variables and a variable can only be used to hold a single value.
  31. Variables do not have:
    attributes or methods.
  32. What is the name of the variable whose content is read only and cannot be changed during the program's execution of the program.
    Named constant.
  33. Which Scanner class method reads an int?
  34. All Java lines of code end with semicolons (true/false).
  35. Which of the following is not a primitive data type?
  36. A variable's scope is the part of the program that has access to the variable (true/false).
  37. Both character literals and string literals can be assigned to a char variable (true/false).
  38. The primitive data types only allow a(n) ________ to hold a single value.
  39. What will be displayed after the following statements have been executed?

    final double x;
    x = 54.3;
    System.out.println("x = " + x );
    Nothing, this is an error.
  40. This is a value that is written into the code of a program.
  41. Programming style includes techniques for consistently putting spaces and indentation in a program so visual cues are created (true/false).
  42. Named constants are initialized with a value, that value cannot be changed during the execution of the program (true/false).
  43. If the compiler encounters a statement that uses a variable before the variable is declared, an error will result (true/false).
  44. In Java the variable named One is the same as the variable named ONE (true/false).
  45. To display the output on the next line, you can use the println method or use this escape sequence in the print method.
Card Set
Java Ch. 2
Java Fundamentals