Booleans Comments
Comments
-  
    =is an assignment, you probability want an equality check==
-  
    I keep getting this error on everything for some reason?? Main.java:16: error: class, interface, or enum expected 
 public static void main(String[] args) {^Main.java:19: error: class, interface, or enum expected 
 int n = in.nextInt(doStuff(4,3));
 ^
 Main.java:20: error: class, interface, or enum expected
 for(int i=0; i
-  
    @NK, you left out a {afterelse. (This made the next}end the class of code.)
-  
    Can someone give me the answer please... I cannot get it. 
-  
    @Nikki, see the first two comments... 
-  
    You can do this in one line of code: return ((b%a)==0); this is the same as 
 if( (b%a)==0){
 return true;}
 else{
 return false;}
-  
    boolean multiple = (a%b == 0); 
 return multiple;this code will work, I am 100% sure 
-  
    I didn't finish reading the whole lesson but what if 
 {
 boolean haveMoneyLeft = yourMoney > yourDebts;
 }What if I have a debt of 500gold and yourMoney is 500gold too 
 this makes:
 {
 boolean haveMoneyLeft = false;
 }
 right ?
-  
    public static boolean doStuff(int a, int b){ 
 boolean x = (a%b==0);
 boolean y = (b%a==0);
 if (a>b)
 {
 return x;
 }
 else
 {
 return y;
 }
 }
-  
    boolean multiple = (a%b == 0); 
 return multiple;worked just fine, thank you!!! 
-  
    i used a longer way but it is still correct :) public static boolean doStuff(int a, int b){ 
 boolean check = false;
 if (a%b == 0){
 check = true;
 }
 return check;
 }
-  
    boolean multiple 
 if(a%b==0)
 {
 return true
 }
 else
 {
 return false;
 }
-  
    Help! 6/3 keeps coming out as false even though my code is: 
 public static boolean doStuff(int a, int b){
 if (b%a==0){
 return true;
 }
 else{
 return false;
 }
 }
-  
    it's a%b. You did the other way around. 
-  
    Bruh anybody got the answers.. 
-  
    Nice this was an easy one. thanks again for the great site. 
-  
    import java.util.Scanner; 
 public class BooleanExm
 {
 public static void main(String[] args)
 {
 double a;
 double b;
 Scanner input = new Scanner(System.in);System.out.println ("Enter any number: "); a = input.nextDouble(); System.out.println ("Enter any number: "); b = input.nextDouble(); boolean output = a%b==0; System.out.println (output); }} 
-  
    import java.util.println; 
 public class Main(){
 public static void main(String[] args){
 int a = 4;
 int b = 2;
 if(a%b==0){
 System.out.println("true");
 }else{
 System.out.println("false");
 }
-  
    import java.util.Scanner; 
 public class Main(){
 public static void main(String[] args){
 int a = 4;
 int b = 2;
 if((a%b)==0){
 System.out.println("true");
 }else{
 System.out.println("false");
 }
 }
 }
-  
    Keep it simple, the answer is right there..... 
 boolean x;
 if(a%b ==0){
 x = true;
 }
 else{
 x=false;
 }
 return x;
 }
-  
    In my solution, I used only =, not == , and I got a correct response. Can you tell me why that is? Thanks. 
Rod
Nov 5, 3:53 AMThis error was returned. What is the problem with this syntax?
Main.java:6: error: unexpected type
return ((a%b) = 0);
^
required: variable
found: value
1 error