JavaProgramming Ch 1-4

  1. What is a Declaration?
    A statement that establishes an identifier and associates attributes with it
  2. What is a Compiler?
    A program that’s used to translate source code into code that can be executed by a computer
  3. What is an Exception?
    An event during program execution that prevents a program from continuing normally; generally, an error
  4. What is an Identifier?
    The name of an item in a program written in the Java programming language
  5. What is a Literal Constant?
    A value that is taken literally at each use
  6. What is a Numeric Constant?
    A number whose value is taken literally at each use
  7. What are Reference types and what are they constructed from?
    Complex data types that are constructed from primitive types
  8. What is a Variable Declaration?
    Statement that reserves a named memory location
  9. What is a Named Constant?
    A memory location whose declaration is preceded by the keyword "final", and whose value cannot change during program execution.
  10. What is a Strongly typed language?
    One in which all variables must be declared before they can be used
  11. What is an Assignment operator and what does it do?
    • The equal sign
    • Any value to the right of the equal sign is assigned to the variable on the left of the equal sign
  12. What is Initialization?
    An assignment made when you declare a variable
  13. What is Assignment?
    The act of providing a value for a variable
  14. What is associativity?
    Refers to the order in which operands are used with operators
  15. What is a Garbage Value?
    The unknown value store in an uninitialized variable
  16. What is a Named Constant (Symbolic Constant)and what keyword is used to instantiate it?
    A memory location whose declaration is preceded by the keyword final and whose value cannot change during program execution
  17. What is an Explicit Conversion?
    The data-type transformation caused using a cast operator
  18. What is a Unary Cast Operator and what does it do?
    A more complete name for the cast operator that performs explicit conversions
  19. Unary operator
    Uses only one operand
  20. Escape Sequence
    • Begins with backslash followed by a character
    • The pair represents a single character
  21. What does it mean to Consume an Entry?
    To retrieve and discard an entry without using it
  22. Implicit Conversion (Promotion)
    The automatic transformation of one data type to another
  23. What is a double-precision floating point number stored in?
    A double
  24. What is a single-precision floating point number stored in?
    A float
  25. What does the Cast Operator do?
    • Performs an explicit-type conversion
    • It is created by placing the desired result type in parenthesis before the expression to be converted
  26. Token
    A unit of data used by the scanner class
  27. Arguments
    All data items sent to methods in a method call
  28. Parameters
    The data items received by a method
  29. Actual Parameters
    The arguments in a method call
  30. Formal Parameters
    The variables in a method declaration that accept the values from actual parameters
  31. What does the return statement do?
    Ends a method and frequently sends a value from a called method back to the calling method
  32. What is an "is-a relationship"?
    The relationship between an object and the class of which it is a member
  33. What do mutator methods do?
    Set values
  34. What do Accessor methods do?
    Retrieve values
  35. What is a "reference to an object"?
    The name for a memory address where the object is held
  36. What is a constructor?
    A method that establishes an object
  37. What is a default constructor?
    Any constuctor that accepts no parameters
  38. Primary Key
    A unique identifier for data within a database
  39. Abstract data type
    A type whose implementation is hidden and accessed through its public methods
  40. What is "implementation hiding"?
    A principle of OOP that describes the encapsulation of method details within a class
  41. What is a method and what must it include?
    • A series of statements that carry out a task.
    • A declaration (or header or definition)
    • Opening curly brace
    • Body
    • Closing curly brace
  42. What does the method declaration contain?
    • Optional: access modifiers
    • return type for the method
    • method name
    • opening parenthesis
    • Optional: list of parameters
    • closing parenthesis
  43. What does a class header contain?
    • Optional: access modifier
    • the keyword: class
    • any legal identifier you choose for the name of your class
    • p.127
  44. Fields and methods used with object instantiations are
    • nonstatic
    • p.127
  45. What is a constructor?
    A constructor always has the same name as what?
    • Constructors are instance methods
    • The class of which it is a member
  46. How are constructors invoked?
    Using the modifier "new" operator
  47. What is a class?
    An abstract, programmer defined, data type
  48. What does object-oriented design do?
    It models the characteristics of abstract or real objects using classes and objects
  49. What does JIT stand for and what does it do?
    • Just-in-time compiler
    • Converts byte code directly into machine language
  50. What does JVM stand for and what does it consist of?
    • Java Virtual Machine
    • byte code instruction set
    • set of registers
    • stack
    • garbage-collected heap
    • an area for storing methods
  51. What is a Block?
    • The code within a set of curly braces
    • p.136
  52. How do you create an instance of a class?
    By using the "new" operator followed by the class name
  53. What is a Method?
    A function defined in a class
  54. What must be included in a method?
    What must a method declaration contain?
    • A declaration (or header or definition)Opening and closing curly braces ({ })
    • A body

    • Optional access modifiers
    • The return type for the method
    • The method name
    • Opening and closing parentheses
    • An optional list of method parameters (multiple parameters are separated by commas)
  55. What are instance methods and what is another term for it?
    • Methods that refer to objects (used with object instantiations).
    • nonstatic methods
  56. What is a multithreaded program?
    A program that’s designed to have parts of its code execute concurrently
  57. What is a "package"?
    A set of related classes
  58. What is a field in java?
    A data member of a class
  59. What is a servlet and what older scripting code do they replace?
    • An executable program that has no“main” routine and so must run inside another environment.
    • CGI
  60. Do variables have to be declared in Java and what do variable declarations include?
    • Yes
    • A data type that identifies the type of data that the variable will store
    • An identifier, which is the variable’s name
    • Optional-an assigned value when you want a variable to contain an initial value
    • An ending semicolon
  61. What is abstraction?
    The programming feature that allows you to use a method name to encapsulate a series of statements
  62. Actual parameters
    Method parameters
  63. Formal parameters
    The variables in the method declaration
  64. What method return type would you use if you want the method to return nothing?
  65. What are the steps to creating a Class?
    • Assign the class a name
    • Determine the data and methods that will be included in the class
    • Create a class header
  66. What are the three parts of a Class header?
    • An access modifier (optional - controls who can use classes, data members, and methods)
    • A keyword class
    • A legal identifier or name of the class
  67. What do mutator methods do?
    • Set values
    • p.126
  68. What do Accessor methods do?
    • Retrieve values
    • p.126
  69. What does the return statement do?
    • Ends a method and frequently sends a value back from the called method to the calling method.
    • p.126
  70. What is an "is-a relationship"?
    • The relationship between an object and the class of which it is a member.
    • p.126
  71. What does assigning private access to a field mean?
    • No other classes can access the field's values, and only methods of the same class are allowed to set, get or otherwise use private variables.
    • p.126
  72. What is an abstract data type?
    A type whose implementation is hidden and accessed through its public methods.
  73. What is a constructor and what keyword is used to invoke a constructor?
    • A method that establishes an object. They have the same name as the class.
    • new
  74. What happens if you don't define a constructor for your class?
    A default, parameterless, constructor is automatically created by the compiler. The default constructor calls the default parent constructor (super()) and initializes all instance variables to default value (zero for numeric types, null for object references, and false for booleans).
  75. True or False?
    -Method headers end in a semicolon
  76. What is overloading a method?
    How is the correct method chosen?
    • Writing multiple methods with a shared name, but each version has different arguments.
    • The correct version of the method is chosen base on which arguments you pass to it.
    • p.142
  77. When an overloaded method has two versions that could be easily confused by the program, you have a problem with _____
    • Ambiguity
    • p.144
  78. Why would you write your own default constructor?
    • So that you can ensure that fields within classes are initialized to some appropriate default value. When you write your own constructors, they can receive parameters.
    • p.147
  79. If a method isn’t associated with an object, it’s a _____ method.
  80. Define:
    literal constant
    • A value that doesn’t change.
    • SG p.31
  81. Define:
    constant variable
    • A variable whose purpose is to hold a value that doesn’t change.
    • SG p.31
  82. What is the purpose of Symbolic constants?
    They enable you to prevent other methods from changing a variable’s value by inserting the keyword "final" into the declaration.
  83. You should use ________ letters when writing constant fields. This will help you to visually distinguish symbolic constants from variables.
  84. A library of classes is also called a ______
    • Package
    • SG p.32
  85. List the three reasons for using symbolic constants rather than literal ones.
  86. What is a reference?
    • An object's memory address
    • p. 150
  87. A reference to an object's nonstatic class method is called a ____ reference.
    Is the above reference always necessary?
    • this
    • It is usually implied, but sometimes you actually have to include the keyword "this" to make a class work correctly.
    • p.150-151
  88. What is the syntax for using a nonstatic method?
    • objectname.methodname();
    • p.150
Card Set
JavaProgramming Ch 1-4
Java Programming Terms and Questions