Java Practice---6

Source: Internet
Author: User

1 //Programmer: Lo Yuanhao 2017.9.242 ImportJava.util.Scanner;3  Public classL {4 5      Public Static voidMain (string[] args) {6         LongA//Exercise 1: Output A variable with a long integer type 1234567890123457a=123456789012345l;8 System.out.println (a);9         Ten         floatb=2.4f;//Exercise 2: Output a single-precision decimal constant 2.4 One System.out.println (b); A            -         BooleanC=true;//Exercise 3: Output A variable of type Boolean - System.out.println (c); theC=false; - System.out.println (c);  -             -         byted=3;//Exercise 4: Forcing type conversions +D= (byte) (b+200); - System.out.println (d);  +               ASystem.out.println ((Char) (' a ' + 1));//Exercise 5: Output 1-character addition calculation atSystem.out.println ((Char) (' You ' +1)); -                  -         inte=integer.max_value+1;//Exercise 6:int also corresponds to a class, the Integer demonstrates the overflow effect of the variable - System.out.println (e); -                  -@SuppressWarnings ("resource")//Exercise 7: arithmetic operator +-*/ inScanner input=NewScanner (system.in); -         DoubleF; toSystem.out.println ("Enter The X"); +f =double.valueof (Input.nextdouble ()); -f=f/1000*1000; theSYSTEM.OUT.PRINTLN ("The calculation result is" +f); *         } $ Panax Notoginseng}

Java Practice---6

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.