Java quiz 2

The flashcards below were created by user david20x6 on FreezingBlue Flashcards.

  1. True/False. String is a primitive data type.
  2. True/False. Strings do not begin with a capital letter
  3. What is the exact code to create a string object?
    String userName = new String("bob");
  4. what is the shortcut to create a string?
    String userName = "Bob";
  5. True/False. Variable names should begin with a lowercase letter
  6. True/False. variables must begin with a letter, underscore, or the dollar sign
  7. True/False Variables may not contain letters, numbers, underscores, question marks, or dollar signs
  8. True/False Data should be variable and constant.
    false. data can be either variable or constant
  9. this means data cannot be changed after the program is compiled
  10. this means data can change while the program is executing
  11. True/False when performing mathematical operations on like datatypes, the result will be the same type
  12. True/False mathematical operations on unlike types results in the same type
    false. results in a conversion.
  13. What is the order that java will implicitly convert
    1. double, 2. float, 3. long, 4. int, 5. short, 6. byte. operands are promoted, but not demoted.
  14. this involves placing the result type in parenthesis before the operand
    type casting
  15. give me an example of type casting
    answer = x + int(y);
  16. what datatype can be used to create a variable which can hold a single character?
  17. where are multiple characters stored?
    String type variables
  18. True/False characters are stored using ASCII
    false. stored using unicode
  19. what are program components grouped into?
    logical objects
  20. these are also known as attributes, data elements, or properties
  21. this is the framework for an object
    a class
  22. objects are created from classes and are referred to as these
  23. code segments within a class or object
  24. how to write code that outputs Hello World
    System.out.println("Hello World");
  25. series of characters handled without interpretation
    literal string
  26. information a method requires to perform a task
  27. True/False classes can contain special characters or spaces
  28. True/False class names must start with a letter or number
    false. must start with a letter, underscore, or dollar sign.
  29. True/False class names should be uppercase
    false. should be lowercase
  30. True/False java is case sensitive
  31. this defines the main method of the class
    method header
  32. what is the syntax for a method header?
    access modifier, return type, method name, arguments. (public static void main(String[] args)
  33. True/False blocks of code are placed within parentheses
    false. placed within curly braces
  34. write a constant with perfect syntax
    static int minAGrade = 90;
  35. write a symbolic constant with perfect syntax
    static final int MIN_A_GRADE = 90;
  36. initialize a char data type
    char userChar = 'B';
  37. How many bits is unicode?
    16 bits
  38. what data type does java use?
  39. how many bits is ASCII?
    8 bit
  40. how are specific characters specified?
    using the "u" escape sequence
  41. write code using the "u" escape sequence
    char myChar = '/u0193';
  42. these are nonexecuting statements that allow you to document your code.
  43. this type of comment is used by the JavaDoc utility supplied by Sun microsystems to document classes.
    JavaDoc comments. use /**
  44. how many classes does java contain for us to use in our programs?
    almost 500
  45. classes are grouped into packages and sometimes called what
  46. how are java prewritten classes used in our programs?
  47. what package contains the fundamental or basic classes?
  48. _____ contains commonly used java language elements such as int, char, long ,etc.
  49. ____ is automatically inserted into every project
  50. which class contains commonly used mathematical functions and constants?
    java.lang.Math. (ex. System.out.println(Math.PI);
  51. where should the import statement be in the java file?
    first statement
  52. what is used to import multiple classes from a package?
  53. provide some examples of importing a class
    • import java.util.Date;
    • import java.util.*;
    • import java.*;
Card Set:
Java quiz 2
2016-02-04 05:58:07
cardset for quiz 2 of java
Show Answers: