Javase: annotation, hexadecimal conversion, variables, and Arithmetic Operators

Source: Internet
Author: User

 

1. Good Programming habits

Comment first, and then code !!

/**
Requirements:
Ideas:
Steps:
@ Autor
...
*/
Then you can start typing the Code. In addition, the Code should also have corresponding single or multiple lines of comments.

 

Binary Conversion

Octal: three binary bits indicate the number of one, which is often starting with "O ".
Hexadecimal: Four Binary bits indicate the number of one, often starting with ox
Convert 8 or 16 to 10: first convert to binary, then add the bit values of 1
[This type of computing is widely used in Oracle TRC files]

 

3 variable

In a word, the variable is a container

When will it be used?
When you store uncertain data

How to use it?
You need to open up a piece of space in the memory and use the following three aspects to determine:
① Data Type
② Variable name
③ Data

Note the following:
Hypothesis:
Byte B = 2;
B = B + 3;
This will prompt loss of precision, because B is a meal of one or two, 3 is int by default, there are four or two meals, perform B + 3, and the hermit will promote B to four or two, the obtained values are four or two, and then B = B + 3 is to pour the four or two meals into the bowl, and the precision is indeed lost.

 

4 Arithmetic Operators

(I) The use of string data and any data + represents the connection, and the final result will be a string
Tip: Enclose the fixed part with double quotation marks and connect it with the plus sign.

class Demo{public static void main(String [] args)        {             int a=2,b;             b=++a;             System.out.println("a=" + a +",b=" + b);         }

 

(Ii) explanations of a ++ and ++ A (home and + homophone)
A ++: A goes out to dinner first, and then goes home for dinner.
+ A: A goes home for dinner and then goes out to play.

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.