Int cannot be converted to boolean?? converting code from C to Java
问题 I have a code that I am converting into Java, Im new to programming but I already have done some work on both PL, although I do not understand why I get this error The original C code is: #include <stdio.h> #include <conio.h> int main () { int i, j, k; for (i=1; i<=59; i++) { k = 1; for (j=2; j<i; j++) if (i % (j*j) == 0) k = 0; if (k) printf ("%d\n", i); } printf("%d",i); getch(); } My converted Java code: import java.util.*; public class squarefree { public static void main(String[] args) {