4. A Java package is a group of classes that
are related by purpose or by application
import javax.swing.*;
import javax.swing.JFrame;
Swing package is used for graphical
desktop application
13. A group of abstract methods defining some behavior
An interface defines a set of methods that a class must implement
interface Driveable {
boolean startEngine();
void stopEngine();
float accelerate( float acc );
boolean turn( Direction dir );
}
14. • Comment in Java コメント
• Java text and core utilities テキスト クラス
• Java collection
• Primitive type in Java(基本タイプ)
• Code structure in Java
24. Type Definition Approximate range or precision
boolean true or false
char 64K characters
byte 8-bit, signed -128 to 127
short
int
long
float
double
26. • int value = 2;
• switch( value ) {
• case 1:
• System.out.println( 1 );
• case 2:
• System.out.println( 2 );
• case 3:
• System.out.println( 3 );
• }
• // prints 2, 3!
Switch①
27. int retValue = checkStatus();
switch ( retVal )
{
case MyClass.GOOD :
// something good
break;
case MyClass.BAD :
// something bad
break;
default :
// neither one
break;
}
An optional default case can be specified to catch unmatched conditions.
Switch②