Java Basics Examples

Source: Internet
Author: User

1  Packageday01;2 ImportJava.util.Scanner;3  Public classAtm {4 5     /**6      * @paramargs7      */8      Public Static voidMain (string[] args) {9         //TODO auto-generated Method StubTenSystem.out.println ("Please enter password"); OneScanner con=NewScanner (system.in); A         //The user enters a password from the keyboard -String line=con.nextline (); -         //if the password equals 1234 the         //string equality in Java is compared with equals -         if(Line.equals ("1234")){ -System.out.println ("1, withdrawals")); -System.out.println ("2, Exit"); +             intnum=con.nextint (); -             Switch(num) { +              Case1: ASystem.out.println ("1, withdrawals 100"); atSystem.out.println ("2, withdrawals 200"); -System.out.println ("3, withdrawals 500"); -System.out.println ("4, other"); -                 intmoney=con.nextint (); -                 Switch(Money) { -                  Case1: inSystem.out.println ("Withdrawal 100!")); -                  Case2: toSystem.out.println ("Withdrawal 200!")); +                  Case3: -System.out.println ("Withdrawal 500!")); the                  Case4: *System.out.println ("Please enter the amount!")); $                     intOther=con.nextint ();Panax NotoginsengSystem.out.println ("Withdrawal:" +other+ "Yuan!) "); -                      Break; the             } +              Break; A              Case2: theSystem.out.println ("Welcome to the next visit!" Exit! "); +              Break; -         } $     } $     } -}

Java Basic Example

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.