1.Copy the preexisting source files you which add to your project.
2.In Project Explorer, right click your project and select New > File
3.In the “New File” dialog box, your project’s name / folder should be displayed as the parent folder for your new (existing) source file.
4.Click on the “Advanced” button at the bottom of the “New File” dialog box.
5.Check the “Link to file in the file system” checkbox.
6.Click the “Browse” and browse to your preexisting source.
7.Click the “Finish” button at the bottom of the dialog box.
Category: Java Programming
eclipse neon
eclipse neon
Naming Conventions
http://www.oracle.com/technetwork/java/codeconventions-135099.html
Data Type
- Numeric Type
- Boolean
- Char
- String
- Enum
int => string vs string => int
int i = -10; // -10
String str4 = String.format(“%d”, i); // “-10”
String x = “123”; // “123”
int y = Integer.parseInt(x); // 123 (integer로 변환이 가능한 경우만 변환 가능 그 외엔 run-time exception error)
int z = Integer.valueOf(x); // 123 (integer로 변환이 가능한 경우만 변환 가능 그 외엔 run-time exception error)
int w = new Integer(x).intValue(); // 123 (integer로 변환이 가능한 경우만 변환 가능 그 외엔 run-time exception error)
Data Type
8 Primitive Data Type
https://en.wikibooks.org/wiki/Java_Programming/Primitive_Types
boolean | A binary value of either true or false |
byte | 8 bit signed value, values from -128 to 127 |
short | 16 bit signed value, values from -32.768 to 32.767 |
char | 16 bit Unicode character |
int | 32 bit signed value, values from -2.147.483.648 to 2.147.483.647 |
long | 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808 |
float | 32 bit floating point value |
double | 64 bit floating point value |
Object Types
Data type | Description |
Boolean | A binary value of either true or false |
Byte | 8 bit signed value, values from -128 to 127 |
Short | 16 bit signed value, values from -32.768 to 32.767 |
Character | 16 bit Unicode character |
Integer | 32 bit signed value, values from -2.147.483.648 to 2.147.483.647 |
Long | 64 bit signed value, values from -9.223.372.036.854.775.808 to 9.223.372.036.854.775.808 |
Float | 32 bit floating point value |
Double | 64 bit floating point value |
String | N byte Unicode string of textual data. Immutable |
Reference Types
class | A class is also a data type – a non primitive reference data type |
interface | An interface is a reference type in Java, it is similar to class, it is a collection of abstract methods. |
array | An array’s type is written as type[] , where type is the data type of the contained elements; arrays are objects, are dynamically created, and may be assigned to variables of type Object |
enum | An enum type is a special data type that enables for a variable to be a set of predefined constants. |
Primitive Types vs Reference Types
https://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html
Primitive Types
A primitive type is predefined by the Java programming language and named by its reserved keyword (§3.9): boolean, integer, long, float, double, byte, short, char.
Reference Types
There are four kinds of reference types: class types (§8), interface types (§9), type variables (§4.4), and array types (§10).
Eclipse
Eclipse Neon (eclipse-java-neon-R-win32.zip) Download
http://www.eclipse.org/downloads/
Eclipse 프로젝트 생성 File->New->Java Project
클래스 생성 File->New->Class
클래스에 코드 추가
실행 Run (Ctrl+F11)
JDK1.8
Java SE 8u102 Download & JDK8 Demos and Samples Download
http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html
Path 지정하기
Java version 확인하기
1.Notepad 사용하여 Java 코드 작성하기 (Notepad.exe Hello.java)
public class Hello {
public static void main(String[] args) {
System.out.println(“hello”);
}
}
2.컴파일 (javac Hello.java)
3.실행 (java Hello)
Java Online Resources
- Java Tutorial
- Java Tutorial
- Java
- 생활코딩 동영상 Java
http://docs.oracle.com/javase/tutorial/tutorialLearningPaths.html
http://www.dotnetperls.com/java
Tutorial http://www.java2s.com/Tutorial/Java/CatalogJava.htm
Tutorial https://opentutorials.org/module/516/4551