创建类
LoginDemo3
这里取反
!(n%3==0)
package com.imooc.operator; import java.util.Scanner;public class LoginDemo3 {public static void main(String[] args) {// TODO Auto-generated method stubSystem.out.println("请输入一个整数");Scanner sc=new Scanner(System.in);int n=sc.nextInt();//能否被3整除 就是对3取余if(!(n%3==0)){System.out.println(n+"不能被3整数!");}else{System.out.println(n+"能被3整数!");}}}
4-3