Friday, August 15, 2014

NETBEANS Java Basics 104 – Operator Precedence

---
NETBEANS Java Basics 104 – Operator Precedence

PREREQUISITE

Download NetBeans from https://netbeans.org/downloads/ 

STEPS

1) Open the Startup Project.

package firstproject;
public class FirstProject {
    public static void main(String[] args) {
        // TODO code application logic here
    }  
}

2) Add Variable Declaration Statement.

2-1 ) Add as follows
package firstproject;
public class FirstProject {
    public static void main(String[] args) {
        double first_number = 100;
        double second_number = 75;
        double third_number = 25;
        double answer = 0;
    }  
}

3) Add multiple assignment and output statements.

3-1) Add multiple assignment and output statements.
package firstproject;
public class FirstProject {
    public static void main(String[] args) {
        double first_number = 100;
        double second_number = 75;
        double third_number = 25;
        double answer = 0;
        answer = first_number - second_number + third_number;
        System.out.println( "Result = " + answer );
        answer = first_number + second_number - third_number;
        System.out.println( "Result = " + answer );
        answer = first_number + (second_number - third_number);
        System.out.println( "Result = " + answer );        
        answer = first_number + second_number * third_number;
        System.out.println( "Result = " + answer );
        answer = (first_number + second_number) * third_number;
        System.out.println( "Result = " + answer );
        answer = first_number / second_number * third_number;
        System.out.println( "Result = " + answer );
        answer = first_number * second_number / third_number;
        System.out.println( "Result = " + answer );
    }  
}
3-2) Outcome.

REFERENCE

---

1 comment:

  1. The 22 Best Casinos in Las Vegas | MapyRO
    If you're 경기도 출장샵 looking for the 의왕 출장마사지 best casinos in Las Vegas, you've come to the right 울산광역 출장마사지 place. 전라남도 출장샵 충주 출장샵 At The Wynn Las Vegas, the possibilities are endless.

    ReplyDelete