SlideShare a Scribd company logo
Java Standard(8~13)

10조 이용진, 이충만, 박노식
8. 삼항연산자


Return a>0 ? True : false;
9. For문
• For(초기값; 조건 ; 스텝)}{
 …..
 }
10. while
• While(조건문){
• …..
• }
11. 기본타입 참조타입
• 기본타입
  – Pass(assign) by value, immutable(불변)
  – public void make(int a)란 메소드가 있을때 make(2); 처럼 값을 넣
    어서 메서드를 사용하는것은 패스바이밸류다.
  – int a = 1; 이라고 했을 때 'a'가 바뀌지 않기 때문에 이것을
    immutable이라 한다.

• 참조타입
  – arr = [a][b][c] , arr[0] = d;는 주소값의 의한 변경.
  – API, User Define, Array
12. Method #1
public static void Main(String[] args){
…}

•   public : 접근 제한자.
•   ■ public : 어디서든지 접근가능. (UML에서는 + 로 사용한다)
•   ■ protected : 상속을 하면 public, 상속을 안하면 private (UML : #)
•   ■ private : 자기 class내에서만 public으로 사용 (UML : -)
•   ■ default : 아무것도 안쓸때 사용됨
    – protected와 비슷하지만 하위class에서 사용불가. (아무것도 안적음)
13. Method #2
•   static : 주소값을 가지냐 가지고 있지않은가?
•   ■ Non-static :
•   ■ static : 메인메서드는 시작과 끝이기 때문에
•   # B b = new B()를 사용하지 않고도, 즉 객체를 생성하지 않고 B클래스내에
    있는 public static void print() 메서드를 사용할 수 있다. - 이것은 어떤 객체를
    생성시킬 필요가 없다.
•

•   # public void print()로 메서드를 생성시켰을 때는 new로 주소를 할당하고 인
    스턴스를 생성해야 메서드가 사용가능하다.
•

•   # 규칙
•   static -> static
•   static -x-> public
•   non-static -> static
•   non-static -x-> non-static
12. Method #3
•   void : 리턴타입
•   return isc == 1 ? true, false
•   클래스도 리턴타입이 될 수 있다.
•   public B isLeafYear(int n){
•   B b;
•   if(n=1){ b = new B();
•   return B;}
•   }
12. Method #4
• String[] arg : 매개변수(parameter)
  – Int myMethod(String str){ …. }


• public void LeafYear(int i)에서 int i는
  argment(호출시의 인수 )
  – String buf = “hi”;
  – String temp = mymethod(buf);
13. Strnig #1
•   참조 타입, Concatenation
•
    String str = "가"
•   String str2 = "나"
•   String msg = str + str2;

•   String + 기본타입 = String (Concatenation)

•   string 11
•   첫번째 숫자를 charAt()은char배열로 바꿔준다.
•   substring, split, tokenizer

•   str = "대한민국"
•   substring(str, 0,3)
•   결과값 : "대한민"
•   char c = str.charAt(0);
13. String #2
•   charAt
•   public char charAt(int index)
•   Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the
    sequence is at index 0, the next at index 1, and so on, as for array indexing.If the char value specified by the index
    is a surrogate, the surrogate value is returned.
•   Specified by:charAt in interface CharSequence
•   Parameters:index - the index of the char value.
•   Returns:the char value at the specified index of this string. The first char value is at index 0.
•   Throws:IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.



•   String substring(int beginIndex)
          Returns a new string that is a substring of this string.
•   String substring(int beginIndex, int endIndex)
          Returns a new string that is a substring of this string.

More Related Content

PPTX
Effective c++ Chapter6
PDF
프로그래밍 대회: C++11 이야기
PDF
C Language For Arduino
PPTX
C++11
PDF
Haskell study 8
PDF
Haskell study 10
PPTX
C# 세미나 12회차
PDF
Haskell study 13
Effective c++ Chapter6
프로그래밍 대회: C++11 이야기
C Language For Arduino
C++11
Haskell study 8
Haskell study 10
C# 세미나 12회차
Haskell study 13

What's hot (20)

PDF
7 mid term summary
PDF
Haskell study 12
PDF
2015 Kitel C 언어 강좌3
PDF
Haskell study 7
PDF
Haskell study 15
PDF
Template at c++
PPTX
The C++ Programming Language 5장 포인터, 배열, 구조체
PPTX
C review
PPTX
3.포인터
PDF
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
PDF
Haskell study 14
PDF
Start IoT with JavaScript - 5.객체2
PDF
Haskell study 9
PDF
Haskell study 4
PDF
PPTX
파이썬 숫자,변수,문자열
PDF
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
PDF
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
PPTX
포인터의 기초(1)
PPTX
포인터의기초 (2) - 포인터 사용하기1
7 mid term summary
Haskell study 12
2015 Kitel C 언어 강좌3
Haskell study 7
Haskell study 15
Template at c++
The C++ Programming Language 5장 포인터, 배열, 구조체
C review
3.포인터
[C++ Korea] Effective Modern C++ MVA item 9 Prefer alias declarations to type...
Haskell study 14
Start IoT with JavaScript - 5.객체2
Haskell study 9
Haskell study 4
파이썬 숫자,변수,문자열
[C++ Korea] Effective Modern C++ MVA item 8 Prefer nullptr to 0 and null +윤석준
Effective Modern C++ MVA item 18 Use std::unique_ptr for exclusive-ownership ...
포인터의 기초(1)
포인터의기초 (2) - 포인터 사용하기1
Ad

Similar to Java standard(8~13) (20)

PPTX
Let's Go (golang)
PPTX
Python programming for Bioinformatics
PDF
Java 변수자료형
PDF
Java_02 변수자료형
PDF
2013 C++ Study For Students #1
PDF
나에 첫번째 자바8 람다식 지앤선
PDF
6 function
PDF
4. stack
PDF
[NDC2016] TERA 서버의 Modern C++ 활용기
PPTX
NHNNEXT 개경프14 Subway Rocket Team Study 3rd C++
PDF
06장 함수
PPTX
Python+numpy pandas 1편
PPT
강의자료4
PDF
안드로이드 설계코드 노하우 및 개발방법
PDF
5장 객체와클래스
PPT
강의자료3
PDF
2014.07.26 KSUG와 지앤선이 함께하는 테크니컬 세미나 - 나의 첫번째 자바8 람다식 (정대원)
PDF
C++에서 Objective-C까지
PPTX
파이썬 스터디 9장
PDF
Api design for c++ 6장
Let's Go (golang)
Python programming for Bioinformatics
Java 변수자료형
Java_02 변수자료형
2013 C++ Study For Students #1
나에 첫번째 자바8 람다식 지앤선
6 function
4. stack
[NDC2016] TERA 서버의 Modern C++ 활용기
NHNNEXT 개경프14 Subway Rocket Team Study 3rd C++
06장 함수
Python+numpy pandas 1편
강의자료4
안드로이드 설계코드 노하우 및 개발방법
5장 객체와클래스
강의자료3
2014.07.26 KSUG와 지앤선이 함께하는 테크니컬 세미나 - 나의 첫번째 자바8 람다식 (정대원)
C++에서 Objective-C까지
파이썬 스터디 9장
Api design for c++ 6장
Ad

Java standard(8~13)

  • 3. 9. For문 • For(초기값; 조건 ; 스텝)}{ ….. }
  • 5. 11. 기본타입 참조타입 • 기본타입 – Pass(assign) by value, immutable(불변) – public void make(int a)란 메소드가 있을때 make(2); 처럼 값을 넣 어서 메서드를 사용하는것은 패스바이밸류다. – int a = 1; 이라고 했을 때 'a'가 바뀌지 않기 때문에 이것을 immutable이라 한다. • 참조타입 – arr = [a][b][c] , arr[0] = d;는 주소값의 의한 변경. – API, User Define, Array
  • 6. 12. Method #1 public static void Main(String[] args){ …} • public : 접근 제한자. • ■ public : 어디서든지 접근가능. (UML에서는 + 로 사용한다) • ■ protected : 상속을 하면 public, 상속을 안하면 private (UML : #) • ■ private : 자기 class내에서만 public으로 사용 (UML : -) • ■ default : 아무것도 안쓸때 사용됨 – protected와 비슷하지만 하위class에서 사용불가. (아무것도 안적음)
  • 7. 13. Method #2 • static : 주소값을 가지냐 가지고 있지않은가? • ■ Non-static : • ■ static : 메인메서드는 시작과 끝이기 때문에 • # B b = new B()를 사용하지 않고도, 즉 객체를 생성하지 않고 B클래스내에 있는 public static void print() 메서드를 사용할 수 있다. - 이것은 어떤 객체를 생성시킬 필요가 없다. • • # public void print()로 메서드를 생성시켰을 때는 new로 주소를 할당하고 인 스턴스를 생성해야 메서드가 사용가능하다. • • # 규칙 • static -> static • static -x-> public • non-static -> static • non-static -x-> non-static
  • 8. 12. Method #3 • void : 리턴타입 • return isc == 1 ? true, false • 클래스도 리턴타입이 될 수 있다. • public B isLeafYear(int n){ • B b; • if(n=1){ b = new B(); • return B;} • }
  • 9. 12. Method #4 • String[] arg : 매개변수(parameter) – Int myMethod(String str){ …. } • public void LeafYear(int i)에서 int i는 argment(호출시의 인수 ) – String buf = “hi”; – String temp = mymethod(buf);
  • 10. 13. Strnig #1 • 참조 타입, Concatenation • String str = "가" • String str2 = "나" • String msg = str + str2; • String + 기본타입 = String (Concatenation) • string 11 • 첫번째 숫자를 charAt()은char배열로 바꿔준다. • substring, split, tokenizer • str = "대한민국" • substring(str, 0,3) • 결과값 : "대한민" • char c = str.charAt(0);
  • 11. 13. String #2 • charAt • public char charAt(int index) • Returns the char value at the specified index. An index ranges from 0 to length() - 1. The first char value of the sequence is at index 0, the next at index 1, and so on, as for array indexing.If the char value specified by the index is a surrogate, the surrogate value is returned. • Specified by:charAt in interface CharSequence • Parameters:index - the index of the char value. • Returns:the char value at the specified index of this string. The first char value is at index 0. • Throws:IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string. • String substring(int beginIndex) Returns a new string that is a substring of this string. • String substring(int beginIndex, int endIndex) Returns a new string that is a substring of this string.