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)