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