20145215 Java programming Second week of study summary

Source: Internet
Author: User

Summary of textbook contents
  • types, variables, and operators

    * Basic Type Integer (ShortIntLong) bytes (byte) floating-point numbers (float/double) characters ( Span class= "Hljs-keyword" >char) identifies a numeric letter or symbol in single quotation marks, the string in double quotation marks (' 4 ') ("Hello") Boolean (boolean): Only two values are unique true/ Falsenull constants: Only one value is null for integers: Java has three representations of decimal: 0-9, full 10 into  18 binary: 0-7, full 8 into 1. Start with 0. Hex: 0-9,a-f, full 16 into 1, denoted by 0x (0x4a2c)    
  • Comments

    //:单行/**/:多行/** */:javadoc文档注释Java严格区分大小写
  • Binary Basic Conversions

    a)  十进制二进制互转(负数的二进制表现形式:对应的整数取反加1)    负数二进制的最高位是1,正数是0b)  十进制八进制互转c)  十进制十六进制互转
  • Variable:

    就是将不确定的数据进行存储。也就是需要在内存中开辟一个空间。空间的类型:数据类型Java是强类型语言,对于每一种数据都定义了明确的具体数据类型,在内存总分配了不同大小的内存空间。定义变量的格式:数据类型  变量名=初始化值(int x=4;)
  • Operator

    1, arithmetic operations + 、-、 *,/, in addition to the plus and minus operators, as well as%: modulo operator. System.Out.println (1 +2 *3), System. out.println ((2 + 2 + 8)/4);  2, comparison, conditional arithmetic;, >+, <, <, =<, =,!= 3, logical operations && (and), | | (OR),! (not)  4, bitwise arithmetic & (and), | (or), ^ (XOR), ~ (complement) where complement: byte number=0; System. out.println (~number); 5, increment, decrement operation int i=0; I=i+1; //i++; System. out.println (i); I=i-1; //i--; System. out.println (i);            
  • Type conversions

    短--长 是安全的长--短 必须强制转换
    • If...else ... Conditional type

    • Switch conditional type

    • For loop



-While Loop

-Break, continue

Problems in teaching materials learning and the solving process

The Code of the 64th page of the textbook is wrong, corrected after the code as follows:

PublicClass shift{Public Static void Main(string[] args) {int number=1; System.out.printf ("2 of the 0-time Parties:%d%nout.printf ( "2 of 1 Times Square: %d%n", number <<  1); System. out.printf ( "2 of 2 times Square: %d%n", number <<  1); System. out.printf ( "2 of 3 times Square: %d%n", number <<  1);}              

The result of the correction is consistent with the results in the textbook.

Problems in code debugging and the resolution process

When you run the following code:

PublicClass comparison{Public Static void Main(string[] args) {System.Out.println"Ten > 5 results%b%n",Ten >5); System.Out.println"Ten >= 5 results%b%n",Ten >=5); System.Out.println "< 5 results%b%n", 10 < < Span class= "Hljs-number" >5); System. out. println ( "<= 5 results%b%n", 10 <= 5); System. out. println ( "10 = = 5 results%b%n", 10 = = 5); System. out. println ( "10! = 5 results%b%n", 10! = 5);}         

An error has popped up

Later through the lookup data found that println is used to output the parameters of the content, and then wrap, the number of parameters fixed to one, and printf is used to output a placeholder with various data types of parameters, the number of parameters is variable, so the above code can only be used with printf, but not with println.

Experience

For us still at rookie level, the simplest and most stupid way to learn Java is to knock the code on the textbook, I see some people just blindly in that look at the code, back code, but never do, in the end a see pop-up error on the panic God. I think a lot of times the code on the book is looking for the feel of their own code, but also in the exercise of their ability to solve problems, seemingly no new action is often the most practical, but also can learn a lot of things, such as the above string of code, if not run, may also not find that the difference between printf and println is so big, and eventually this vague passed. So, learn Java, start by tapping the code. I'm going to refuel.

Learning progress Bar /Cumulative) new/cumulative)
lines of code (newBlog volume (Learning time (new/cumulative) Important growth
Goal 3500 rows 30 Articles 300 hours
First week 100/100 2/2 20/20 Basic knowledge
Second week 300/300 4/4 40/38 Get a deeper look
Third week 300/800 4/6 40/60
Week Four 300/1200 4/8 40/90
Resources
    • Java Learning Notes (8th Edition)
    • Java Learning Note (8th Edition) Learning Guide

20145215 Java Programming the second week of learning summary

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.