[NHN NEXT] Java 강의 - Week1
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

[NHN NEXT] Java 강의 - Week1

on

  • 2,437 views

Java 강의 1주차

Java 강의 1주차

Statistics

Views

Total Views
2,437
Views on SlideShare
1,872
Embed Views
565

Actions

Likes
19
Downloads
58
Comments
0

4 Embeds 565

http://news.imaso.co.kr 556
http://feedly.com 6
http://www.inoreader.com 2
http://blog.naver.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

[NHN NEXT] Java 강의 - Week1 Presentation Transcript

  • 1. PL
  • 2.   in
  • 3.   
  • 4.    Week01
  • 5.    Java? 조영호
  • 6.    snatcher@nhn.com
  • 7.    Java!
  • 8.   
  • 9. 프로그래밍
  • 10.   연습
  • 11.   C/C#
  • 12.   과정을
  • 13.   
  • 14.    이수하셨다면
  • 15.    오늘
  • 16.   배우는
  • 17.   내용은
  • 18.   아주
  • 19.   쉽습니다
  • 20.    C
  • 21.    C#
  • 22.    Java
  • 23.    단순
  • 24.   변환
  • 25.   
  • 26. C C# Java Week1
  • 27.   
  • 28. To p i c s 
  • 29.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 30. Hello World!
  • 31.   
  • 32. 에디터를
  • 33.   이용해
  • 34.   코드
  • 35.   작성
  • 36.    public  class  Hello  {          public  static  void  main(String  []  args)  {                  System.out.println("Hello,  World!");          }   }   Hello.java
  • 37. Compile
  • 38.    Compile javac Hello.java Hello.class
  • 39. Execute
  • 40.    Execute java Hello Hello.class Hello class의
  • 41.    main() 메서드를
  • 42.   실행하라
  • 43.    World.class Call
  • 44. 에디터를
  • 45.   이용해
  • 46.   코드
  • 47.   작성
  • 48.    public  class  Hello  {        public  static  void  main(String  []  args)  {                System.out.print("Hello,  ");                World.print();        }   }   Hello.java World.java public  class  World  {        public  static  void  print()  {              System.out.println("World");        }   }
  • 49. Compile
  • 50.    Compile javac Hello.java Hello.java Hello.class Compile World.java World.class CallWorld.print();
  • 51. Execute
  • 52.    Execute java Hello Hello.class World.class Call
  • 53. Linking??
  • 54.   
  • 55. Dynamic Class Loading
  • 56.    Execute java Hello Hello.class World.class Load Hello class
  • 57. Dynamic Class Loading
  • 58.    Execute java Hello Hello.class World.class Call Load Hello class World.print(); Load World class
  • 59. Java Virtual Machine
  • 60.    Hello.class World.class Load Hello class Load World class JVM
  • 61. OS
  • 62.    Hello.class World.class Load Hello class Load World class JVM OS
  • 63.    Byte Code (OS에
  • 64.   독립)
  • 65.    (OS에
  • 66.   종속)
  • 67.   
  • 68. Write Once Run Anywhere
  • 69.    WORA
  • 70.   
  • 71. Eclipse
  • 72.   
  • 73. To p i c s 
  • 74.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 75. 규칙
  • 76.   훑어
  • 77.   보기
  • 78.    public  class  Hello  {          public  static  void  main(String  []  args)  {                  System.out.println("Hello,  World!");          }   }   모든
  • 79.   코도는
  • 80.   반드시
  • 81.   
  • 82.    클래스
  • 83.   안에
  • 84.   위치
  • 85.    public
  • 86.   클래스
  • 87.   이름은
  • 88.   
  • 89.    파일명과
  • 90.   동일하게
  • 91.    명령행
  • 92.   인자를
  • 93.   전달
  • 94.   받는
  • 95.   
  • 96.    문자열
  • 97.   배열
  • 98.    main()
  • 99.   메서드는
  • 100.   
  • 101.    반드시
  • 102.   하나만
  • 103.   
  • 104.    존재해야
  • 105.   함
  • 106.    화면에
  • 107.   출력하기
  • 108.   위해서는
  • 109.   
  • 110.    System.out.println(“..”)
  • 111.   또는
  • 112.   
  • 113.    System.out.print()
  • 114.   사용
  • 115.    모든
  • 116.   문장은
  • 117.   ‘;’으로
  • 118.   종료
  • 119.    클래스
  • 120.   선언
  • 121.    public
  • 122.   class
  • 123.   클래스명
  • 124.   {
  • 125.   
  • 126.    }
  • 127.    “{”은
  • 128.   
  • 129.    같은
  • 130.   행에
  • 131.   
  • 132.   
  • 133. 명명
  • 134.   규칙
  • 135.    public  class  Hello  {          public  static  void  main(String  []  args)  {                  System.out.println("Hello,  World!");          }   }   클래스
  • 136.   이름은
  • 137.    첫글자만
  • 138.   대문자로
  • 139.   시작
  • 140.    매개변수,
  • 141.   지역변수는
  • 142.    소문자로
  • 143.   시작
  • 144.    메소드
  • 145.   이름은
  • 146.   소문자로
  • 147.   시작
  • 148.   
  • 149. Camel Case
  • 150.    ClassName
  • 151.    methodName
  • 152.    variableName
  • 153.   
  • 154. To p i c s 
  • 155.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 156. Type Size Min Max boolean 8bit false true char 16bit u0000 uffff byte 8bit -128 127 short  16bit  -32,768  32767  int  32bit  -2,147,483,648  2,147,483,647  long 64bit -9,223,372,036,854,775,808 9,223,372,036,854,775,807  float  32bit 7개의
  • 157.   유효
  • 158.   숫자를
  • 159.   가지며,
  • 160.    -3.4E+38의
  • 161.   근사값
  • 162.    7개의
  • 163.   유효
  • 164.   숫자를
  • 165.   가지며,
  • 166.    3.4E+38의
  • 167.   근사값
  • 168.    double  64bit  15개의
  • 169.   유효
  • 170.   숫자를
  • 171.   가지며,
  • 172.    -1.7E+308의
  • 173.   근사값
  • 174.    15개의
  • 175.   유효
  • 176.   숫자를
  • 177.   가지며,
  • 178.    1.7E+308의
  • 179.   근사값
  • 180.    Primitive Type
  • 181.   
  • 182. public  class  Primitve  {        public  static  void  main(String  []  args)  {              boolean  booleanValue  =  true;              byte  byteValue  =  10;              char  charValue  =  'A';              short  shortValue  =  10;              int  integerValue  =  10;              long  longValue  =  10;              float  floatValue  =  0.1f;              double  doubleValue  =  0.1;   System.out.printf("%b  %d  %c  %d  %d  %d  %f  %f",                        booleanValue,  byteValue,  charValue,  shortValue,                        integerValue,  longValue,  floatValue,  doubleValue) ;      }   }   Primitive.java Primitive Type
  • 183.   
  • 184. diff C/C# Java
  • 185.    unsigned int
  • 186.    uint
  • 187.    or
  • 188.    No
  • 189. diff C C#/Java
  • 190.    No Pointer Type
  • 191.   
  • 192. diff C C#/Java
  • 193.    Value Type(Primitive Type)
  • 194.    Reference Type
  • 195.    boolean, char, byte, short , int , long, float , double  String, Object, Array … Pointer Type ?
  • 196.   
  • 197. Stack Heap Value Type
  • 198.    ReferenceType
  • 199.    Stack & Heap
  • 200.    boolean, char, byte, short , int , long, float , double  String, Object, Array
  • 201. Heap diff C C#/Java
  • 202.    No
  • 203.    malloc
  • 204.    calloc
  • 205.    realloc
  • 206.   
  • 207. diff C C#/Java
  • 208.    new
  • 209.    Heap
  • 210. public  class  NewIsMalloc  {      public  static  void  main(String  []  args)  {          int  sum  =  0;          int  []  intArray  =  new  int  []  {1,  2,  3,  4,  5};          for(int  loop=0;  loop<intArray.length;  loop++)  {              sum  +=  intArray[loop];          }   System.out.println(sum);      }   }   NewIsMalloc.java new
  • 211.   
  • 212. Stack Heap Value Type
  • 213.    ReferenceType
  • 214.    Stack & Heap
  • 215.    sum 0 1 2 3 4 5intArray
  • 216. new를
  • 217.   이용한
  • 218.   메모리
  • 219.   할당
  • 220.   불가능
  • 221.    주소
  • 222.   참조
  • 223.   불가능
  • 224.    Primitive Type diff C C#/Java
  • 225.   
  • 226. diff C/C# Java
  • 227.    No struct
  • 228.    Use Class
  • 229.   
  • 230. Heap diff C C#/Java
  • 231.    No
  • 232.    free
  • 233.   
  • 234. Heap diff C C#/Java
  • 235.    Garbage Collection
  • 236.   
  • 237. To p i c s 
  • 238.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 239. C String
  • 240.    char *school = "Next"; char school[5] = "Next"; int length = strlen(school); char first = school[0];
  • 241. C# String
  • 242.    char first = school[0]; int length = school.Length; string school = "Next";
  • 243. Java String
  • 244.    String school = "Next"; int length = school.length();
  • 245. Procedural vs Object-Oriented
  • 246.    char *school = "Next"; int length = strlen(school); String school = "Next"; int length = school.length(); Data Function Data + Function
  • 247. To p i c s 
  • 248.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 249. C = C# = Java
  • 250.   
  • 251. To p i c s 
  • 252.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 253. C = C# = Java
  • 254.    if, switch, for, while
  • 255.   
  • 256. diff C C#/Java
  • 257.    C 0 == false !0 == true No boolean
  • 258.   
  • 259. diff C C#/Java
  • 260.    C int number = 0; if (number = 1) { printf("truen"); } else { printf("falsen"); }
  • 261. diff C C#/Java
  • 262.    C# Java bool
  • 263.    boolean
  • 264.   
  • 265. C# Java int  positive  =  10;   if  (positive)  {        ... }   boolean  positive  =  true;   if  (positive)  {    ... }   diff C C#/Java
  • 266.    // error
  • 267. diff C C#/Java
  • 268.    switch(???)
  • 269.    C C#/Java 정수계열 정수계열 문자열
  • 270. C <->C# <-> Java
  • 271.   
  • 272. #include <stdio.h> #include <time.h> #include <stdlib.h> int main(int argc, char *argv[]) { int number; int count = 1; srand((int)time(NULL)); number = (rand() % 100) + 1; printf("1~100사이의 컴퓨터가 생각한 숫자를 맞춰 보세요. 6번까지 시도할 수 있습니다.n"); do { int guess; printf("생각하신 숫자는? "); scanf("%d", &guess); if (guess != number && count == 6) { printf("6번의 시도가 모두 종료되었습니다. 다음에 다시 시도해 주세요.n"); break; } if (guess == number) { printf("성공하셨습니다!!!n"); break; } if (guess > number) { printf("너무 높네요!n"); } else { printf("너무 낮네요!n"); } count++; } while (1); } C
  • 273. using System; namespace Guess { class Guess { public static void Main(string[] args) { Random random = new Random(); int number = random.Next(1, 101); Console.WriteLine("1~100사이의 컴퓨터가 생각한 숫자를 맞춰 보세요. 6번까지 시도할 수 있습니다."); int count = 1; do { Console.Write("생각하신 숫자는? "); int guess = int.Parse(Console.ReadLine()); if (guess != number && count == 6) { Console.WriteLine("6번의 시도가 모두 종료되었습니다. 다음에 다시 시도해 주세요."); break; } if (guess == number) { Console.WriteLine("성공하셨습니다!!!"); break; } if (guess > number) { Console.WriteLine("너무 높네요!"); } else { Console.WriteLine("너무 낮네요!"); } count++; } while (true); } } } C#
  • 274. package Guess; import java.util.Scanner; public class Guess { public static void main(String [] args) { int number = (int)(Math.random() * 100) + 1; System.out.println("1~100사이의 컴퓨터가 생각한 숫자를 맞춰 보세요. 6번까지 시도할 수 있습니다."); int count = 0; do { System.out.print("생각하신 숫자는? "); Scanner scanner = new Scanner(System.in); int guess = scanner.nextInt(); scanner.close(); if (guess != number && count == 6) { System.out.println("6번의 시도가 모두 종료되었습니다. 다음에 다시 시도해 주세요."); break; } if (guess == number) { System.out.println("성공하셨습니다!!!"); break; } if (guess > number) { System.out.println("너무 높네요!"); } else { System.out.println("너무 낮네요!"); } count++; } while (true); } } Java
  • 275. To p i c s 
  • 276.    JVM & Class Convention Data Type String Operation Condition & Loop Array
  • 277. 1차원
  • 278.   배열
  • 279.   
  • 280. C
  • 281.    #include <stdio.h> void show_arrays(int [], int); int main(int argc, char *argv[]) { int arrays[] = {1, 2, 3, 4, 5}; int len = sizeof(arrays) / sizeof(int); int *ptr_arrays = arrays; show_arrays(ptr_arrays, len); } // void show_arrays(int *arrays, int len) void show_arrays(int arrays[], int len) { int loop; for(loop=0; loop < len; loop++) { printf("%dt", arrays[loop]); } printf("n"); }
  • 282. using System; namespace Arrays { class Arrays { public static void Main(string[] args) { int[] arrays = new int[] { 1, 2, 3, 4, 5 }; ShowArrays1(arrays); ShowArrays2(arrays); } public static void ShowArrays1(int[] arrays) { for (int loop = 0; loop < arrays.Length; loop++) { Console.Write("{0}t", arrays[loop]); } Console.WriteLine(); } public static void ShowArrays2(int[] arrays) { foreach (int each in arrays) { Console.Write("{0}t", each); } Console.WriteLine(); } } } C#
  • 283.   
  • 284. public class  Arrays  {     public static void main(String [] args) { int [] arrays = new int [] { 1, 2, 3, 4, 5 }; showArrays1(arrays); showArrays2(arrays); } public static void showArrays1(int [] arrays) { for (int loop = 0; loop < arrays.length; loop++) { System.out.printf("%dt", arrays[loop]); } System.out.println(); } public static void showArrays2(int[] arrays) { for(int each : arrays) { System.out.printf("%dt", each); } System.out.println(); } } Java
  • 285.   
  • 286. 2차원
  • 287.   배열
  • 288.   
  • 289. C
  • 290.    #include <stdio.h> void show_arrays(int (*)[5], int len); int main(int argc, char *argv[]) { int arrays[3][5] = { { 1, 2, 3, 4, 5}, { 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15} }; int rows = sizeof(arrays) / sizeof(arrays[0]); show_arrays(arrays, rows); } void show_arrays(int (*arrays)[5], int rows) { int row; for(row=0; row < rows; row++) { int col; for(col=0; col<5; col++) { printf("%dt", arrays[row][col]); } printf("n"); } printf("n"); }
  • 291. using System; namespace Arrays { class Arrays { public static void Main(string[] args) { int[, ] arrays = new int[,] { { 1, 2, 3, 4, 5}, { 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15} }; ShowArrays1(arrays); } public static void ShowArrays1(int[,] arrays) { for (int row = 0; row < arrays.GetLength(0); row++) { for (int col = 0; col < arrays.GetLength(1); col++) { Console.Write("{0}t", arrays[row, col]); } Console.WriteLine(); } Console.WriteLine(); } } } C#
  • 292.   
  • 293. public class Arrays { public static void main(String [] args) { int [][] arrays = new int [][] { { 1, 2, 3, 4, 5}, { 6, 7, 8, 9, 10}, {11, 12, 13, 14, 15} }; showArrays1(arrays); } public static void showArrays1(int [][] arrays) { for (int row = 0; row < arrays.length; row++) { for(int col=0; col<arrays[row].length; col++) { System.out.printf("%dt", arrays[row][col]); } System.out.println(); } System.out.println(); } } Java
  • 294.