February 20 learning

8:00: 40 to 12:00
Learning Java
harvest:
a .Java specific types of data:
Here Insert Picture Description
Precautions: re-defined data types when the float, floating point if the initial value, must be added after the data represents a F or f the floating-point data type, otherwise it will be the default system is a double.
Differs from the two mathematical operations .Java
1. The connection string
for example

String name="kite";
int age=18;
String adress="hunan";
String massage=name+age+adress;
System.out.println(massage);

Wherein the information is called connection with a kite string up massage, simply can be connected to the + sign, and may also be connected to a plurality of simultaneously, as compared to the strcat functions in C language to be more simple.
2. Logical operators
& means and, if conditions are established for the ture
| representation or, as long as a condition for the establishment ture
! Represent Africa, it represents the opposite conclusion, it is false ture, ture it is false
shorted language
&& if a condition is not met, the latter statement is no longer calculated, the condition is false
|| if a condition is met, back statement is not calculated, the condition is ture
methods .java three strings
. statement
the charAt
length
the substring
TRIM
the indexOf
explanation:
for example the sub-

String s="hello world!";
System.out.println(s.charAt(4));//输出s[4];也就是'o';
//charAt 直接查找字符串中的某一号元素
System.out.println(s.length());//输出s字符串的长度,也就是12;
//length 查找字符串长度,和C语言中strlen语句类似
System.out.println(s.substring(2,4));
//输出字符串中二号到四号元素,包含前面但是不包含后面就是会输出s[2]但不会输出s[4];
//也有另一种表达方式  s.substring(2);只有一个数,表示从二号元素开始输出至末尾

//trim 去掉俩边空格 
String S="  hello world!  ";
System.out,println(S.trim());//输出是hello world
//去掉俩边空格,不去掉中间的空格
//indexOf  查找一个字符或一个字符串子段在字符串中出现的首个位置
System.out.println(s.indexOf('l'));//输出结果是2,因为s[2]为'l';
System.out.println(s.indexOf("world"));//输出结果为6
//因为world首次出现的位置为6,该位置为子字符串的首个字母的位置

14 pm: 15 ~ 16: 00
Ting seniors lectures and organize lectures
16:00 - 18:00
do question (weekly task)
night
20:00 ~ 22:00
watch the video Java learning
objectives: learn to use Java arrays

Published 17 original articles · won praise 0 · Views 530

Guess you like

Origin blog.csdn.net/sheep_princess/article/details/104424311