Open1B

PHOTO EMBED

Sun Feb 12 2023 00:43:48 GMT+0000 (Coordinated Universal Time)

Saved by @Achilles_17

class statementB{
    int x1;
    double x1;
    statementB(int x1, double x1){
    this.x1 = x1;
    this.x1 = x1;
    }
    boolean methodB(){
    return (x1 == x1);
  }

}
public class Open1B{
   statementB agentA = new statementB(7, 7.0);
    statementB agentB = new statementB(7, 7.0);
   boolean example1 = agentA.methodB();
   
}
// Program Output: 
//jpdesilva@Juans-MacBook-Pro cse11-pa3-starter-main % ./run Open1b.java
//Open1B.java:3: error: variable x1 is already defined in class statementB
//    double x1;
//          ^
//Open1B.java:4: error: variable x1 is already defined in constructor statementB
//    statementB(int x1, double x1){
//                              ^
//Open1B.java:5: error: incompatible types: possible lossy conversion from double to int
//    this.x1 = x1;
//              ^
//Open1B.java:6: error: incompatible types: possible lossy conversion from double to int
//    this.x1 = x1;
//              ^
//4 errors
//jpdesilva@Juans-MacBook-Pro cse11-pa3-starter-main % 
content_copyCOPY