AP Notes, Outlines, Study Guides, Vocabulary, Practice Exams and more!

Introductory Java Language Features

Classes, types, identifiers, operators, I/O, storage, binary/hex, control structures, errors and exceptions

Terms : Hide Images
335117881Java developerJames Gosling (with a team) at Sun Microsystems
335117882Classes should......begin with a capital letter
335117883The identifier 'myVariable' demonstrates......camel case
335117884OOPObject-Oriented Programming
335117885Block comment syntax/**blah blah blah**/
335123645Single line syntax// blah blah blah
335123646All Java methods must be contained in a ...class
335123647public, static, void and main are examples of...reserved words
335123648Reserved words akakeywords
335123649Methods that will not access any objects of a classstatic
335127850Java files comprising your programsource files
335127851Converts source code to machine-readable formcompiler
335127852Machine-readable codebytecode
335127853Extension for machine-readable codeclass
335127854Extension for source codejava
335127855Java program that runs inside a web browserapplet
335127856'dog' vs 'Dog' demonstratescase sensitivity
335127857Halmark of good identifier namesself-documenting
335131403Variable nameidentifier
335131404'Container' for a piece of informationvariable
335131405Denotes the kind of information stored in a variabledata type
335131406Java is a heavily ______ languagetyped
335133317Binary data typeboolean
335133318Data type indicative of a single symbolchar
335135481int x;declaration
335135484double pi = 3.14;declaration/initialization
335135486Given: int myVal; myVal = 8; //this statement, an example of ...initialization
335138648Java is a ______ languagecase-sensitive
335138649int x = 2; int y = 3; double quotient = (double) x/y; //an example of...casting
335139817Delimiter symbol(s) for a class{ }
343943509Equivalent to: x /=2;x = x/2;
343943510Equivalent to: x = x + 1;x++;
343943511Write a complete declaration/initialization for an integer called r that is the remainder when 8 is divided by 3int r = 8%3;
343943512Another name for % operatormodulus operator
343943513Number of bytes in an int4
343943514Number of bits in an int32
343943515Number of bits in a byte8
343943516Integer.MAX_VALUE2^31 - 1 (^ stands for 'raised to the power of')
343943517Integer.MIN_VALUE-2^31 (^ stands for 'raised to the power of')
343943518NaNNot a Number
343943519Number base for hexadecimal16
343943520Largest symbol in a hexadecimal valueF
343943521To denote a hex number in Java, use this prefix0x or 0X
343943522Key word denoting a user-defined constantfinal
343943523Constant identifiers are, by convention, ________capitalized
343943524Given: int x = 17; int y = 4; double q = x/y; What will be the value of q?4
343943525When a computer processes the expression: 5/2 and yields a '2' as a result, the answer is said to be ______________truncated
343943526Relational operator for 'equal to'==
343943527Relational operator for 'not equal to'!=
343943528Relational operator for 'less than or equal to'<=
343943529Logical operator for 'AND'&&
343943530Logical operator for 'OR'||
343943531Name of the '|' symbolpipe
343943532Simple assignment operator=
343943533Increment operator++
343943534Decrement operator--
343943535Concatenation symbol+
343943536The expression '\n' is known as an ______ _______escape sequence
343943537Newline escape sequence\n
343943538Double quote escape sequence\"
343943539Backslash escape sequence\\
343943540An escape sequence is used to print _____ ______special characters
343943541Syntax for one-way selectionif(){ /** **/ }
343965020A ______ expression is one that can be evaluated as either true or falseboolean
343965021True or false: 'true' is a reserved word in Javatrue
343965022Syntax for two-way selectionif(){ /** **/ }else{ /** **/ }
343965023If an 'if' block itself contains an 'if' block, the result is a ________ if statementnested
343965024Delimiters for selection logic blocks with multiple lines{ }
343965025Syntax for standard 'fixed iteration' repetition structurefor(; ; ){ /** **/ }
343965026'for-each' syntax for a repetition structurefor(SomeType element : collection) { /** **/ //read as 'for each element of type SomeType in collection... }
343965027Output of: for(int k = 20; k >=15; k--) System.out.print(k + " ");20 19 18 17 16 15
343965028Output of: for(int j = 2; j <=10; j+=2) System.out.print(j + " ");2 4 6 8 10
343965029Output of: for(int k = 20; k <=15; k--) System.out.print(k + " ");//no output: termination condition met in first pass
343965030Syntax for pre-condition repetition structurewhile() { /** **/ }
343965031The body of a while loop must contain ________A statement that leads to termination
343965032An ______ loop never endsinfinite
343965033Loops that contain other loops are known as ______ loopsnested
343965034An _______ is an error condition that occurs during the execution of a Java programexception
343965035Use this exception to guard against division by zeroArithmeticException
343965036Use this exception to make sure the correct value of a parameter is being usedIllegalArgumentException
343965037Use this exception to make sure you do not exceed the size of an arrayArrayIndexOutOfBoundsException
343965038Correct the error: if(age = 2) System.out.println("Terrible two");if(age == 2) System.out.println("Terrible two");
343965039Syntax for post-condition repetition structuredo { /** **/ }while();
343965040Hex value of binary number: '10110010'B2
343965041Decimal value of hex number: 'B2'178
344872501Output of: for(int k = 1; k <=5; k++); System.out.print(k + " ");6
354207564You want to use keyboard input for an application. What line lets bring in the necessary library?import java.util.Scanner;
354207565How do you create an object (called 'keyBoard') to read user-input from the keyboard, assuming the necessary libraries have been brought in?Scanner keyBoard = new Scanner(System.in);
354207566You have created an object named 'keyBoard' to read user-inputs. Use it to read a String value into a variable named 'userName' . Write a complete line of code.String userName = keyBoard.nextLine();
354207567You have created an object named 'keyBoard' to read user-inputs. Use it to read an integer value into a variable named 'age' . Write a complete line of code.int age = keyBoard.nextInt();
367921566Ternary operator?:
367921567if(happyAndKnowIt)sound = clapHands(); else sound=booHoo(); //Write using shortcutsound = (happyAndKnowIt)? clapHands():booHoo();

Need Help?

We hope your visit has been a productive one. If you're having any problems, or would like to give some feedback, we'd love to hear from you.

For general help, questions, and suggestions, try our dedicated support forums.

If you need to contact the Course-Notes.Org web experience team, please use our contact form.

Need Notes?

While we strive to provide the most comprehensive notes for as many high school textbooks as possible, there are certainly going to be some that we miss. Drop us a note and let us know which textbooks you need. Be sure to include which edition of the textbook you are using! If we see enough demand, we'll do whatever we can to get those notes up on the site for you!