求大神帮解三题关于java的题目

fyang33 2017-02-24 08:32:12
多谢了


...全文
170 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
自由自在_Yu 2017-02-24
  • 打赏
  • 举报
回复
引用 7 楼 smile_from_2015 的回复:
1.square(x) 314763729 2.boolean result = checkEven(num); System.out.println(result?aa+" is odd on screen":aa + " is even on screen"); 3.static int getMaxInteger(int x,int y,int z){ int max = Math.max(Math.max(x, y), z); return max; }
mon_ice 2017-02-24
  • 打赏
  • 举报
回复
public class PracticeTwo
{
    static boolean checkEven(int num){
        return num % 2 == 0;
    }
    
    public static void main(String[] args)
    {
        int num;
        @SuppressWarnings("resource")
        Scanner scan = new Scanner(System.in);
        System.out.println("Enter an integer: ");
        num = scan.nextInt();
        System.out.println(checkEven(num)? num + " is even" : num + " is odd");
    }
}
result: Enter an integer: 2 2 is even
朝 花 拾 夕 2017-02-24
  • 打赏
  • 举报
回复
1.square(x) 314763729 2.boolean result = checkEven(num); System.out.println(result?aa+" is odd on screen":aa + " is even on screen"); 3.static int getMaxInteger(int x,int y,int z){ int max = Math.max(Math.max(x, y), z); return max; }
mon_ice 2017-02-24
  • 打赏
  • 举报
回复
public class PracticeOne
{
    static int square(int number){
        return number*number;
    }
    public static void main(String[] args)
    {
        int x = 67895;
        int result = square(x);
        System.out.println("square of "+ x + " is " + result);
    }
}
output: square of 67895 is 314763729
朝 花 拾 夕 2017-02-24
  • 打赏
  • 举报
回复
哈哈哈,可以,程序猿的福利,扭扭头,防止颈椎病
fyang33 2017-02-24
  • 打赏
  • 举报
回复
引用 3 楼 qnmdcsdn 的回复:
颈椎已废
我的锅啊大神。
  • 打赏
  • 举报
回复
颈椎已废
fyang33 2017-02-24
  • 打赏
  • 举报
回复
引用 1 楼 mon_ice 的回复:
你是不是颈椎病康复中心的间谍
他这个发出来就这样了。
mon_ice 2017-02-24
  • 打赏
  • 举报
回复
你是不是颈椎病康复中心的间谍

50,523

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧