Learning Unit 3 Programming Theory Flashcards
(37 cards)
\n (new line)
Forces a new line
\t (tab space)
- Indicates tab space
- Cannot be used with showMessageDialog method
- Work with standard text output system.out.println()
- Leaves 8 spaces
Not a
Primitive data type
Strings are fundamental to Java
Has a number of features that we don’t find in other classes.
- The way a string object may be initialized.
Initializing a string involves using
A resolved word new.
You can use char.At(_) method with
Objects of String class.
Positions for string start at
0
Has no parameters
In brackets
Java requires that any method name must be followed by an
Opening and closing bracket
Can only be used with
String types.
Methods of Math class are used for some
Are used for some mathematical operations which do not have operators in Java.
Important skill in programming
Find and use methods that have already been written to achieve your goal before your try to code your own solutions.
Method is static
Called using class name.
No object needs
To be instantiated to call methods.
NaN (Not a Number)
Is a run time error.
Math.pow();
- Requires 2 parameters
- Data type type of parameters: int/double
- Function: returns the first value raised to the power of the second value.
- Data type of return: double
Math.round();
- Requires: parameter
- Data type of parameter: double
- Function: returns round off value.
- Data type of return: double
Character values are written
Between single quotation marks.
Characters are represented in Java
By Unicode character set.
Unicode set:
A big table of all the characters on the keyboard as well as many more characters from different languages, Braille patterns and all sorts of symbols.
Each character has a unique number
So that the computer can identify one from another.
There are some special characters which we use quite often but do not have a single character symbol on the keyboard
(new line character/ return/enter and tab character)
Escape sequences have unique Unicode values but
It is more convenient and understandable to express them using escape sequences.
Instead of system.out.println() to display text on output screen, you can use
showMessageDialog() method of JOptionPane class to display in GUI