Java (iii)

Source: Internet
Author: User

Sum of any integers:

(1)

1 ImportJava.util.Scanner;2 3  Public classSum {4 5@SuppressWarnings ("Resource")6      Public Static voidMain (string[] args) {7         //TODO auto-generated Method Stub8SYSTEM.OUT.PRINTLN ("You want to enter several numbers:");9         intNextValue;TenScanner Kblnput =NewScanner (system.in); OneNextValue =kblnput.nextint (); A         intNum[] =New int[NextValue]; -         intsum = 0; -System.out.print ("The number entered is:"); the          for(inti = 0; i < num.length; i++) { -Num[i] =kblnput.nextint (); -Sum + =Num[i]; } -System.out.println ("Their and is:" +sum); +     } -  +}

Run effect

(2)

1 ImportJava.util.Scanner;2 3 4  Public classTest_scanner {5 6     /**7      * @paramargs8      */9      Public Static voidMain (string[] args) {Ten          One         intNextvalue,sum = 0; AScanner Kbinput =NewScanner (system.in);//creating the Scanner class -Kbinput.usedelimiter ("\\s");//Set delimiter -          while(Kbinput.hasnextint ()) {//Use the Hasnextint () method to determine if there is an integer theNextValue = Kbinput.nextint ();//reads the next integer in the data stream -Sum + =NextValue;  -         } -Kbinput.close ();//Close Stream Object +System.out.println ("Sum:" +sum); -     } +  A}

Run:

* Final Course Design:

QQ Login interface, friends list interface and chat box interface.

function Realization: Simple function can be realized, such as: Click Login to enter the Friend list interface, click Friends can enter the chat box, chat can input and output, can also change the font color size.
Division of Labor: Cheng Wen, Xin Yihong do login interface, realize login function, Mi Jianxia do QQ chat interface, realize chat function.

Sketch:

Java (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.