Java data type explained

Source: Internet
Author: User

Data type explanation

1. Input and output of float type data (written in Notepad).

public class c2_2{public static void Main (String args[]) {float x, y, Z;        x=94.3f;        y=32.9f;        z=x/y;    System.out.println (x+ "/" +y+ "=" +z "); }}123456789101112

The output results are as follows:
650) this.width=650; "src=" http://img.blog.csdn.net/20150721135424016 "alt=" here write a picture describing "title=" "/>

2, Character type variable

public class c2_3{public static void Main (String args[]) {char c1,c2,c3;//declaration variable C1,C2,C3 is a character variable c1= ' H '; The character H c2= ' \ \ ' is stored in the storage unit identified by C1,//The character c3= ' \115 ' is stored in the storage unit identified by C2,//The ASCII character M System represented by the octal number 115 in the storage unit identified by C3        . Out.print (C1);        System.out.print (C2);    System.out.print (C3); }}

Operation Result:
650) this.width=650; "src=" http://img.blog.csdn.net/20150721163045686 "alt=" here write a picture describing "title=" "/>

3. Boolean variable

public class c2_4{public static void Main (String args[]) {Boolean x,y,z;//declares variable int a=89,b=20; x= (a>b);//Boolean variable assignment y= (a!=b);//Boolean variable assignment z= (a+b==43);//Boolean Variable assignment System.out.println ("x=" +x);//Output Boolean The value of the variable System.out.println ("y=" +y);//The value of the output Boolean variable System.out.println ("z=" +z);//output Boolean variable value}}

Run results
650) this.width=650; "src=" http://img.blog.csdn.net/20150721164338121 "alt=" here write a picture describing "title=" "/>

This article is from the "Sanghaidan blog column" blog, please be sure to keep this source http://10602803.blog.51cto.com/10592803/1683051

Java data type explained

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.