Basics

Card Set Information

Author:
wgaynor
ID:
285359
Filename:
Basics
Updated:
2014-10-09 14:19:53
Tags:
Java
Folders:
Java
Description:
Studying
Show Answers:

Home > Flashcards > Print Preview

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


  1. Which of the following statements is correct;
    A: new, delete and goto are keywords in Java
    B: try, catch and thrown are keywords in Java
    C: static, unsigned and long are keywords in Java
    D: exit, class, and while are keywords in Java
    E: return, goto and default are keywords in Java
    E: return, goto and default are keywords in Java
  2. Which 3 packages are imported by default?
    A: java.util
    B: System
    C: java.lang
    D: java.io
    E: String
    F: The package with no name
    G: The current package
    • C: java.lang
    • F: The package with no name
    • G: The current package
  3. Which 2 are valid identifiers?
    A: class
    B:$value$
    C: angstrom
    D: 2much
    E: zer@
    • B: $value$
    • C: angstrom
  4. Which array declaration and instantiations are legal?

    A: int[] a[] = new int[5][4];
    B: int a[][] = new int[5][4];
    C: int a[][] = new int[][4];
    D: int[]a[] = new int[4][];
    E: int[][] a = new int[5][4];
    • A: int[] a[] = new int[5][4];
    • B: int a[][] = new int[5][4];
    • D: int[]a[] = new int[4][];
    • E: int[][] a = new int[5][4];
  5. Which of these statements concerning the charAt() method of the String class are true?

    A: The charAt() method can take a char value as an argument
    B: The charAt() method returns a Character object
    C: The expression char ch = "12345".charAt(3) will assign 3 to ch.
    D: The expression char ch = str.charAt(str.length()) where str is "12345" will assign 3 to ch.
    E: The index of the first character is 0.
    F: It throws StringIndexOutOfBoundsException if passed a value higher than or equal to the length of the string (or less than 0).
    G: It throws ArrayIndexOutofBoundsException if passed an value higher than or equal to the length of the string (or less than 0).
    • A: because it takes an int and char will be implicitly promoted to int.
    • E: index of first character is 0

What would you like to do?

Home > Flashcards > Print Preview