Friday, 22 July 2016

Java Programming: Solving Problems with Software,

// You can use this program to run experiments
// 1. Add statements inside main
// 2. Compile
// 3. Right-click on the Test rectangle and select main
// 4. Click Ok on the next dialog
// 5. The output is displayed in a terminal window

public class Test
{
    public static void main(String[] args)
    {
        // Add something inside the ( )
        //compile time error
        //System.out.println(a b);
        //prints total and in only one line
        //System.out.print(3+4+5);
        //runtme Error
        //System.out.println(1/0);
        //prints total and goes to the next line
        //System.out.println(3+4+5);
        //prints the string as it is "3+4+5"
        //System.out.println("3+4+5");
        // Add more statements below, as needed
        System.out.print("My Lucky number is");
        System.out.println(3 + 4 + 5);
    }
}

No comments:

Post a Comment