Java Learning 1: java Learning

Source: Internet
Author: User

Java Learning 1: java Learning

Public class Beijing {public static void main (String arge []) {int age = 23; // defines the int type long c = 2323232; // define the long integer char beij = 'hangzhou'; System. out. print (beij); boolean beijing = false; // defines boolenSystem. out. println (beijing) ;}// Definition

  

 

Public class Dingyi {public static void main (String args []) {short a = 0; int I = 11; long l = 22; double d = 555; float m = 1.9f; system. out. println (I/m * d/l);} // operation

  

 

Public class Iftest {public static void main (String args []) {int I = 2; if (I> 1 & I <11) {System. out. println ("I is located at 1 and 11");} else {System. out. println ("I is not between 1 and 11") ;}}// if statement

  

 

 

Public class Switchjava {public static void main (String args []) {char c = '1'; switch (c) {case 'B': System. out. println ('n'); break; case 'A': System. out. println ('B'); break; default: System. out. println ('D') ;}}// switch statement

 

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.