분류 전체보기 (347) 썸네일형 리스트형 자바 100제 12번 scanner nextline package java_algorithm; import java.util.Scanner; public class ex100_12 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); String word = scan.nextLine(); System.out.println(word); } } 자바 100제 11번 scanner nextline 응용 package java_algorithm; import java.util.Scanner; public class ex100_11 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String cha01 = sc.nextLine(); String cha02 = sc.nextLine(); System.out.println(cha02 + "" + cha01); } } 자바 100제 10번 scanner nextInt 응용 package java_algorithm; import java.util.Scanner; public class ex100_10 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int i = sc.nextInt(); int e = sc.nextInt(); System.out.println(i + "" + e); } } 자바 100제 9번 scanner nextdouble package java_algorithm; import java.util.Scanner; public class ex100_9 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); double i = scan.nextDouble(); System.out.println(i); } } 자바 100제 8번 scanner nextLine package java_algorithm; import java.util.Scanner; public class ex100_8 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); String i = sc.nextLine(); System.out.println(i); } } 자바 100제 7번 문제 스캐너 // ex100_7.java package java_algorithm; import java.util.Scanner; public class ex100_7 { public static void main(String[] args) { // TODO Auto-generated method stub // 스캐닝(system.in)으로 작동하는 스캐너 객체 생성 Scanner sc = new Scanner(System.in); // int i 변수에 다음에 적히는 nextint()정수를 담는다. int i = sc.nextInt(); System.out.println(i); } } ArrayList functions import java.util.ArrayList; public class Array { public static void main(String[] args) { // ArrayList =a resizable array // Elements can be added and removed after compilation phase // store reference data types ArrayList food = new ArrayList(); // 이렇게 더할 수 있다. food.add("pizza"); food.add("hamburger"); food.add("hotdog"); // set function을 사용하면 이렇게 대체할 수 있다. food.set(0, "sushi"); // 이렇게 삭제할 수도 있.. 생성자와 Getter Setter // 아래는 붕어빵 생산을 위한 붕어빵 틀이라고 보면 된다. public class User { //public User() { // //} 따로 생성자를 생성하지 않으면 자동적으로 생성되는 기본생성자 String name; // 이름 int age; // 나이 String hobby; // 취미 // 다른 클래스에서 위 생성자를 받도록 하기 위해서는 아래처럼 준비해줘야 한다. // 현재 위의 상태는 생성자를 선언만 해둔 상태라고 이해하면 됨. // this는 붙히지 않아도 되는데 파라미터값과 비슷할 때 구분을 위해 사용하기도 함. // alt shift s 단축키를 누르면 바로 생성할 수 있다. public User (String _name, int _age, String _hobby) { this.n.. 이전 1 ··· 22 23 24 25 26 27 28 ··· 44 다음