JAVA 文法勉強１

public class main {
    public static void main(String[] args) {
        //정수

        long l = 30L;
        int x = 30;
        short s = 30;
        byte b = 30;
        int i = (int) 30L;
        long ll = 30;  // int

        double dd = 30.0;
        float ff = 30.0f;
        dd = ff;
        ff = (float) dd;


        boolean isMarried = true;
        isMarried = false;
        char c = 'a';
        char cc = '한';
        String str = "여러 글자";


        System.out.printf("저는 %s입니다. 나이는 %d살이구요, 키는 %fcm입니다.\n", "홍길동", 20, 174.0f);
        String str2 = String.format("저는 %s입니다. 나이는 %d살이구요, 키는 %fcm입니다.", "홍길동", 20, 174.0f);
        System.out.println(str2);

    }
}
public class main {
    public static void main(String[] args) {
        System.out.println(Math.max(10, 30));
        System.out.println(Math.min(10, 30));
        System.out.println(Math.abs(-30));

    }

    public class main {
        public static void main(String[] args) {
            String str = "100" ;
                    int i = Integer.parseInt(str);
                    long l = Long.parseLong(str);
                    String str2 = String.valueOf(i)
            System.out.println(i)
            System.out.println(str2);

        }

        public class main {
            public static void main(String[] args) {
                Random random = new Random();
                int rand = random.nextInt(4) + 5; // 5 ~ 9

                //0 ~ 4 => 5 ~ 14
                // 5 ~ 9

                System.out.println(rand);
            }

                public class main {
                    public static void main(String[] args) {
                        Scanner scanner = new Scanner(System.in);

                        String str = scanner.next();
                        int i = scanner.nextInt();
                        long l = scanner.nextLong();
                        System.out.println(scanner.next());
                    }
                    public class main {
                        public static void main(String[] args) {
                            int i = 6;
                            if (i < 3) {
                                System.out.println("참");
                            } else if (i < 5) {
                                System.out.println("거짓");
                            } else {
                                System.out.println("나머지");
                            }
                        }
                    }
                    public class main {
                        public static void main(String[] args) {
                            boolean isMarried = true;
                            boolean isMan = false;

                            String str;

                            str = isMarried ? "결혼했다": "결혼 안 했다";
                            if (isMarried && !isMan) {
                                str = "결혼했다";
                            } else {
                                str = "결혼 안 했다";
                            }
                            switch (str) {
                                case "결혼했디":
                                    System.out.println("o");
                                case "결혼 안 했다":
                                    System.out.println("x");
                                default:
                                    System.out.println("?");
                            }
                            System.out.println(str);
                            public class main {
                                public static void main(String[] args) {
                                    for (int i = 0; i <10; i++) {
                                        System.out.println(i);
                                        int i = 0;
                                        while (i < 10) {
                                            System.out.println(i);
                                            i++;
                                        }
                                        int i = 0;
                                        do {
                                            System.out.println(i);
                                            i++;
                                        } while (i < 10);
                                    }
                                        }
                                public class main {
                                    public static void main(String[] args) {
                                        for (int i = 0; i <10; i++) {
                                            System.out.println(i);
                                            if (i=6) {
                                                break;
                                            }
                                        }