import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String arg[]){
        // sample code
        int a = -10;
        System.out.println("a="+a);
        if(a > 0){
            System.out.println("aは正の数です。");
        }
        
        int a2 = -5;
        System.out.println("a2="+a2);
        if(a2 > 0){
            System.out.println("a2は正の数です。");
        }else{
            System.out.println("a2は正の数ではありません。");
        }

        int dice = (int)(Math.random()*7)+1;
        System.out.println("さいころの目:"+dice);
        if(1 <= dice && dice <= 6){
            if(dice == 2 || dice == 4 || dice == 6){
                System.out.println("丁(チョウ)です。");
            }else{
                System.out.println("半(ハン)です。");
            }
        }else{
            System.out.println("範囲外の数値です。");
        }

        int num = 1;
        switch(num){
        case 1:
            System.out.println("one");
            break;
        case 2:
            System.out.println("two");
            break;
        case 3:
            System.out.println("three");
            break;
        default:
            System.out.println("不適切な値です。");
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: