2013년 8월 7일 수요일

Primitive Data Types

( http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html )




byte
short
int
long
float
double
boolean
char


uninitialized field will be set to a default value by the compiler.
but, uninitialized local variable will not be set to a default value by the compiler.
accessing an uninitialized local variable will result in a compile-time error!



// The number 26, in decimal
int decVal = 26;

//  The number 26, in hexadecimal
int hexVal = 0x1a;

// The number 26, in binary
int binVal = 0b11010;




null can be used as a value for any reference type.

class literal refers to the object that represents the type itself.
      ex) String.class





Package




package is a namespace that organizes a set of related classes and interfaces.

conceptually I can think of packages as being similar to different folders.




Java Platform, Standard Edition 7 API Specification

http://docs.oracle.com/javase/7/docs/api/index.html




Interface



interface

interface is a group of related methods with empty bodies.



implements keyword



public keyword to the implemented interface methods.







inheritance




inheritance 

superclass
subclass


one direct superclass
unlimited number of subclass


extends keyword



2013년 8월 6일 화요일

Lesson: A Closer Look at the "Hello World!" Application


( http://docs.oracle.com/javase/tutorial/getStarted/application/index.html )






public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}






The Java language support three kinds of commnets:

/* text */

/** documentation */

// text






Every application begins with a class definition.

Every application must contain a main method whose signature is:

      public static void main(String[] args)