中文字幕在线一区二区在线,久久久精品免费观看国产,无码日日模日日碰夜夜爽,天堂av在线最新版在线,日韩美精品无码一本二本三本,麻豆精品三级国产国语,精品无码AⅤ片,国产区在线观看视频

      Java基礎筆試題

      時間:2024-07-07 01:32:07 JAVA認證 我要投稿
      • 相關推薦

      2017年Java基礎筆試題

        Java的主要工作是通過編程語言來制作互聯(lián)網(wǎng)頁面、制作動態(tài)效果以及網(wǎng)站等技術,現(xiàn)在網(wǎng)上關于這方面的教程有很多。下面是小編整理的關于Java基礎筆試題,希望大家認真閱讀!

      2017年Java基礎筆試題

        1、 編寫程序,實現(xiàn)1到100之間整數(shù)的累加并輸出運算結果。

        public class a

        {

        public static void main(String[] args)

        {

        int i,s=0;

        for(i=1;i<=100;i++)

        {

        s=s+i;

        }

        System.out.println("1到100的累加和是"+s);

        }}

        2、編寫程序,計算1~100中奇數(shù)的累加和并輸出。

        public class a

        {

        public static void main(String[] args)

        {

        int i,s=0;

        for(i=1;i<=100;i++)

        {

        if(i%2!=0)

        s=s+i;

        }

        System.out.println("1到100的奇數(shù)累加和是"+s);

        }}

        3、編寫程序,計算1~100中偶數(shù)的累加和并輸出。

        public class a

        {

        public static void main(String[] args)

        {

        int i,s=0;

        for(i=1;i<=100;i++)

        {

        if(i%2==0)

        s=s+i;

        }

        System.out.println("1到100的偶數(shù)累加和是"+s);

        }}

        4、比較兩個數(shù)的大小,找出其中的最大數(shù)并輸出。

        import java.io.*;

        public class ka

        { public static void main(String[] args) throws IOException

        {

        float? x,y,m;

        m=0;

        InputStreamReader readerx=new InputStreamReader(System.in);

        BufferedReader inputx=new BufferedReader(readerx);

        System.out.println("請輸入x:");

        String tempx=inputx.readLine();

        x = Float.parseFloat(tempx);

        InputStreamReader readery=new InputStreamReader(System.in);

        BufferedReader inputy=new BufferedReader(readery);

        System.out.println("請輸入y:");

        String tempy=inputy.readLine();

        y= Float.parseFloat(tempy);

        if(x>y)

        {

        m=x;

        }else

        {

        m=y;

        }

        System.out.println("最大數(shù)為"+m);

        }

        }

        5、比較兩個數(shù)的大小,找出其中的最小數(shù)并輸出。

        import java.io.*;

        public class ka

        { public static void main(String[] args) throws IOException

        {

        float? x,y,m;

        m=0;

        InputStreamReader readerx=new InputStreamReader(System.in);

        BufferedReader inputx=new BufferedReader(readerx);

        System.out.println("請輸入x:");

        String tempx=inputx.readLine();

        x = Float.parseFloat(tempx);

        InputStreamReader readery=new InputStreamReader(System.in);

        BufferedReader inputy=new BufferedReader(readery);

        System.out.println("請輸入y:");

        String tempy=inputy.readLine();

        y= Float.parseFloat(tempy);

        if(x{

        m=x;

        }else

        {

        m=y;

        }

        System.out.println("最小數(shù)為"+m);

        }

        }

        6、編寫一個Java程序,判斷某年份是否為閏年。

        import java.io.*;

        public class testa

        {

        public static void main(String[] args) throws IOException

        {

        float? x;

        InputStreamReader reader=new InputStreamReader(System.in);

        BufferedReader input=new BufferedReader(reader);

        System.out.println("請輸入x:");

        String temp=input.readLine();

        x =Float.parseFloat(temp);

        if(x@0==0)

        {

        System.out.println(+x+"是閏年");

        }

        else

        if(x%4==0)

        {

        System.out.println(+x+"是閏年");

        }

        else{ System.out.println(+x+"不是閏年");}

        }

        }

        7、比較兩個數(shù)的大小,找出其中的最大數(shù)和最小數(shù)并輸出。

        import java.io.*;

        public class ka

        { public static void main(String[] args) throws IOException

        {

        float? x,y;

        InputStreamReader readerx=new InputStreamReader(System.in);

        BufferedReader inputx=new BufferedReader(readerx);

        System.out.println("請輸入x:");

        String tempx=inputx.readLine();

        x = Float.parseFloat(tempx);

        InputStreamReader readery=new InputStreamReader(System.in);

        BufferedReader inputy=new BufferedReader(readery);

        System.out.println("請輸入y:");

        String tempy=inputy.readLine();

        y= Float.parseFloat(tempy);

        if(x{

        System.out.println("最小數(shù)為"+x);

        System.out.println("最大數(shù)為"+y);

        }else

        {

        System.out.println("最小數(shù)為"+y);

        System.out.println("最大數(shù)為"+x);

        }

        }

        }

        8、比較兩個數(shù)的大小,找出其中的最大數(shù)和最小數(shù),并輸出最大數(shù)和最小數(shù)之差。

        import java.io.*;

        public class ka

        { public static void main(String[] args) throws IOException

        {

        float? x,y,m;

        InputStreamReader readerx=new InputStreamReader(System.in);

        BufferedReader inputx=new BufferedReader(readerx);

        System.out.println("請輸入x:");

        String tempx=inputx.readLine();

        x = Float.parseFloat(tempx);

        InputStreamReader readery=new InputStreamReader(System.in);

        BufferedReader inputy=new BufferedReader(readery);

        System.out.println("請輸入y:");

        String tempy=inputy.readLine();

        y= Float.parseFloat(tempy);

        if(x{

        System.out.println("最小數(shù)為"+x);

        System.out.println("最大數(shù)為"+y);

      【Java基礎筆試題】相關文章:

      經(jīng)典的Java基礎面試題09-02

      java基礎筆試題及答案10-18

      sun認證java基礎模擬試題10-26

      java基礎面試題201708-28

      NIIT認證Java基礎全真模擬試題09-17

      2017年經(jīng)典的Java基礎面試題06-24

      Java的基礎知識07-27

      JAVA模擬試題及答案10-18

      Java基礎知識詳解09-02

      Java入門基礎知識:Java IO(輸入/輸出)09-23

      主站蜘蛛池模板: 亚洲精品中文字幕二区 | 亚洲区1区3区4区中文字幕码| 水蜜桃一二二视频在线观看免费| 珠海市| 无码中文字幕专区一二三| 亚洲女同成av人片在线观看| 无码制服丝袜中文字幕| 97国产精品麻豆性色| 晋宁县| 久久99国产亚洲高清观看首页| 亚洲av影片一区二区三区| 免费国产调教视频在线观看| 日韩中文字幕区一区有砖一区| 沾益县| 奉新县| 常熟市| 北宁市| 五月婷婷激情六月开心| 丰台区| 国产精品亚洲ΑV天堂无码| 阳高县| 国产高潮自拍视频在线观看| 通州市| 国产啪精品视频网站免| 好爽~又到高潮了毛片视频| 保定市| 一区二区三区午夜视频在线观看| 日本亚洲成人中文字幕| 国产精品亚洲精品日产久久久| 精品在免费线中文字幕久久| 天天射天天操天天综合网| 视频| 对白刺激的老熟女露脸| 婷婷色亚洲五月在线国产精品麻豆| 69av视频在线| 精品人妻丰满久久久a| 一区二区三区在线视频在线观看| 日本香蕉久久一区二区视频| av天堂在线视频播放| 亚洲公开免费在线视频| 日本免费一区二区三区国产视频|