Java Language Basics _ Learning Notes

Source: Internet
Author: User

ImportJava.util.Scanner; Public classHelloWorld {Static Final Doublepi=3.14; Static intx=125; /*** Document Comment, program name: HelloWorld * Development time: 2016-03-07 * hehe **/     Public Static voidMain (string[] args) {//TODO auto-generated Method StubSystem.out.println ("I can learn java!!."); System.out.println ("Good BYE liuliu~"); //variablesString var = "Hi world!";                System.out.println (VAR); intX=521,y=123; floati=1.23f; Doublej=100.123d; SYSTEM.OUT.PRINTLN (x+y+i*pi+j);                System.out.println (helloworld.x); CharStr= ' a '; CharStr1= ' \ n '; CharStr2= ' \u2605 ';        System.out.print (str);        System.out.print (STR1);                System.out.print (STR2); //operatorScanner scan=NewScanner (system.in); System.out.print ("Please enter the value of variable a"); LongA=Scan.nextlong (); System.out.print ("Please enter the value of variable B"); Longb=Scan.nextlong (); System.out.println ("A=" + A + "b=" +b); System.out.println ("Perform variable swaps, displacement can only be integral"); A=a^b; b=b^A; A=a^C; System.out.println ("A=" + A + "b=" +b); String Check= (a% 2 ==0)? " A is even ":" A is odd ";                SYSTEM.OUT.PRINTLN (check); //Forcing type conversions        intLiua= (int) 78.33; LongLiub= (Long) 17.8; intLiuc= (int) ' A ';  Shortliud=521; byteLiue= (byte) Liud;//byte maximum of 127, resulting in data overflowSystem.out.println ("A:" +liua+ ", B:" +liub+ ", C:" +liuc+ ", D:" +liud+ ", E:" +liue); //determine if the year entered is a leap yearsSystem.out.print ("Please enter a year: The rules for leap years can be divisible by 4 or 400 and not divisible by 100. )"); LongYear=Scan.nextlong (); if(Year% 4 ==0 && year%!! = 0 | | Year% 400 ==0) {System.out.println ( year+ "is a leap year"); }        Else{System.out.println ( year+ "is not a leap year. "); }            }    }

Java Language Basics _ Learning Notes

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.