当前位置:网站首页>July 28, 2022 Gu Yujia's study notes
July 28, 2022 Gu Yujia's study notes
2022-07-29 03:09:00 【Sister haha】
Java Value passing and so-called reference passing
Essentially java As long as the value is passed , All assignment parameters are copies of values
The reference data type copies the reference address , The basic data type copies values , The instance object itself is not passed
Interview questions : The result of the printout is ?

Output results :

Commonly used api( Application program interface )
JDK Provide some written classes , Methods can be called directly to solve the problem
Class method , On the macro level, it can become an interface .
Time related api
The time zone : East eight
Beijing time. :+8
Time stamp ( The world is fixed ): Get the timestamp , It can be converted into the specific time and date of our current location through timestamp .
Time stamp : GMT 1970.1.1 00:00:00 To the end 2022.7.28 9:29:30 Millisecond count
1s = 1000ms , 1min = 60s , 1h = 60min , 1day =24h.
Get the timestamp // It can be converted into the specific time and date of our current location through timestamp System.out.println(System.currentTimeMillis());Get the current date and time of the system Date date = new Date(); System.out.println(date); compareTo
When you return a negative number , It indicates that the caller time is before the parameter time .
When to return to 0 when , It indicates that the caller time is the same as the parameter time .
When a positive number is returned , Explain that the caller's time is after the stated time .
Calendar class : date 、 Time
Calendar Is an abstract class , can new Cannot create object
initialization ;
Provides a set of pairs “ Specific date 、 Minutes and seconds 、 week ” And other information operation functions . You can manipulate information in different time zones .
JDK1.1 Version start , When processing time and date , System recommended Calendar class
Calendar than Date Much more powerful
Unless you want to obtain the time, minutes and seconds of month, day and year at one time , Otherwise, all use Calendar.
The time zone
ZoneId( Get a place id)
Date formatting (SimpleDateFormat) format: format Date type , hold Date Type into String type We want to show the data to the client . parse: hold String Type of time , Turn into Date type The time transmitted from the client , It's usually String type , Store in database .
yyyy Represents the year ,yy The last two representatives of the year
MM Representative month
dd On behalf of the day
HH For hours (24 hourly ) hh For hours (12 hourly )
mm On behalf of
ss On behalf of the second
SSS On behalf of ms
The methods of tool classes are static
New time class
Instant
LocalDate
LocalTime
DateTimeFormatter
The duration of the Duration
LocalDate: Get current date
Execution results :
Determine if it's a leap year
Local time LocalTime
Get day and time LocalDateTime
Deal with the formatting of dates DateTimeFormatter
hold Instant Turn into Date
hold Date Turn into Instant
hold Instant Turn into LocalDateTime
hold LocalDateTime Turn into Instant
hold Date Turn into LocalDateTime
hold LocalDateTime Turn into Date
Math Mathematics
random number random() double
Rounding up ceil() double
Rounding down floor()double
rounding round()long
BigDecimal Statistics
Random classes Random
Arrays—— Array tool class
Sort of array
Array search
Array copy
Array comparison
System class —— System class
Objects( Tool class )JDK1.7
Judge whether it is empty
StringBuffer and StringBuilder—— A variable sequence of characters
and String There are essential differences
StringBuffer You cannot assign values directly with the equal sign
![]()
Additional
Delete
![]()
Delete the specified location
![]()
Insert
![]()
reverse ( The interview will ask )
![]()
String How to reverse ?
1.
![]()
2.
![]()
StringBuffer yes ( Threads ) synchronous . Security , Low efficiency
StringBuilder It's asynchronous . unsafe , Efficient
Interview questions : The difference between the three strings

边栏推荐
猜你喜欢
随机推荐
MySQL忘记密码怎么办
C language small project - address book (static version + dynamic version + file version)
MYSQL入门与进阶(十三)
单例模式(饿汉式 懒汉式)
力扣刷题之分数加减运算(每日一题7/27)
Analysis of Project-based Learning Creativity in steam Education
C陷阱与缺陷 第2章 语法“陷阱” 2.6 “悬挂”else引发的问题
「PHP基础知识」输出圆周率的近似值
Tp5.0 applet users do not need to log in and directly obtain the user's mobile number.
Why did I choose the test when the development salary was high?
C traps and defects Chapter 3 semantic "traps" 3.2 pointers to non arrays
数字图像处理 第10章——图像分割
Detailed steps for installing MySQL 8.0 under Linux
Unable to start after idea installation
Chapter 2 VRP command line
vasp计算任务报错:M_divide:can not subdivide 8 nodes by 6
扫雷简单版
C and pointer Chapter 3 semantic "trap" 3.5 null pointer is not a string
Analysis of concepts and terms in data warehouse
Inventory of domestic and foreign project collaborative management software: SAAS and customization become a trend







Execution results :



























