javaSE总结笔记-6

ChatGPT Plus完整开通指南:从账号注册到稳定使用全流程 自然语言处理(NLP)技术通过深度学习模型实现对人类语言的理解与生成,其核心原理是基于Transformer架构的大规模预训练。GPT-4作为当前最先进的生成式AI模型,在代码编写、文档分析等场景展现出显著的技术价值。在实际应用中,稳定的网络环境和合规的支付方式是确保AI助手持续服务的关键因素。针对ChatGPT Plus的开通,需要系统性地解决账号验证、虚拟信用卡支付等工程实践问题,才能实现工作流的高效整合。 阅读详情

简单概述

此文章是自己进行java学习的一个总结内容, 可能会有多篇内容.

API

定义

API是Application Program Interface的缩写, 其表示为应用程序的编程接口, 实际是一套固定的编程规则方法, 也就是别人将相关的方法与类封装好, 我们直接进行调用, 不需要知道其实现过程.

常用API

Objects类

定义

Objects类是java所有类的根类

方法
方法名称方法描述(原文)-JDK1.8
static String toString(Object o)Returns the result of calling toString for a non-null argument and “null” for a null argument.
static boolean equals(Object a, Object b)Returns true if the arguments are equal to each other and false otherwise.Consequently, if both arguments are null, true is returned and if exactly one argument is null, false is returned. Otherwise, equality is determined by using the equals method of the first argument.

String类

定义

String类是一个不可变的字符串, 其底层实现为字符串数组.

常用的构造方法
构造方法
String(byte[] bytes)Constructs a new String by decoding the specified array of bytes using the platform’s default charset.
String(byte[] bytes, int offset, int length)Constructs a new String by decoding the specified subarray of bytes using the platform’s default charset.
String(char[] value)Allocates a new String so that it represents the sequence of characters currently contained in the character array argument.
String(char[] value, int offset, int count)Allocates a new String that contains characters from a subarray of the character array argument.
String(String original)Initializes a newly created String object so that it represents the same sequence of characters as the argument; in other words, the newly created string is a copy of the argument string.
常用的方法
方法名称方法描述(原文)-JDK1.8
boolean isEmpty()Returns true if, and only if, length()is 0.
boolean contains(CharSequence s)Returns true if and only if this string contains the specified sequence of char values.
boolean startsWith(String prefix)Tests if this string starts with the specified prefix.
boolean endsWith(String suffix)Tests if this string ends with the specified suffix.
boolean equals(Object anObject)Compares this string to the specified object.
boolean equalsIgnoreCase(String anotherString)Compares this String to another String, ignoring case considerations.
int length()Returns the length of this string.
String concat(String str)Concatenates the specified string to the end of this string.
char charAt(int index)Returns the char value at the specified index.
int indexOf(String str)Returns the index within this string of the first occurrence of the specified substring.
int indexOf(String str, int fromIndex)Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
String substring(int beginIndex)Returns a string that is a substring of this string.
String substring(int beginIndex, int endIndex)Returns a string that is a substring of this string.
char[] toCharArray()Converts this string to a new character array.
byte[] getBytes()Encodes this String into a sequence of bytes using the platform’s default charset, storing the result into a new byte array.
String replace(char oldChar, char newChar)Returns a string resulting from replacing all occurrences of oldChar in this string with newChar.
String toLowerCase()Converts all of the characters in this String to lower case using the rules of the default locale.
String toUpperCase()Converts all of the characters in this String to upper case using the rules of the default locale.
String[] split(String regex)Splits this string around matches of the given regular expression.

StringBuilder类

定义

String类是一个可变的字符串, 其底层实现为字符串数组.

常用构造方法
构造方法构造方法描述(原文)-JDK1.8
StringBuilder()Constructs a string builder with no characters in it and an initial capacity of 16 characters.
StringBuilder(int capacity)Constructs a string builder with no characters in it and an initial capacity specified by the capacity argument.
StringBuilder(String str)Constructs a string builder initialized to the contents of the specified string.
常用方法
增加

append()

insert()

删除

delete()

deleteCharAt()

修改

replace()

setCharAt()

查询

charAt()

length()

capacity()

Date类

常用的构造方法
构造方法构造方法描述(原文)-JDK1.8
Date()Allocates a Date object and initializes it so that it represents the time at which it was allocated, measured to the nearest millisecond.
Date(long date)Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as “the epoch”, namely January 1, 1970, 00:00:00 GMT.
常用的方法
方法名称方法描述(原文)-JDK1.8
long getTime()Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
void setTime(long time)Sets this Date object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.

SimpleDateFormat类

定义

专门对日期进行格式转换的

常用的构造方法
构造方法构造方法描述(原文)-JDK1.8
SimpleDateFormat()Constructs a SimpleDateFormat using the default pattern and date format symbols for the default FORMAT locale.
SimpleDateFormat(String pattern)Constructs a SimpleDateFormat using the given pattern and the default date format symbols for the default FORMAT locale.
常用的方法
方法名称方法描述(原文)-JDK1.8
StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos)Formats the given Date into a date/time string and appends the result to the given StringBuffer.
Date parse(String text, ParsePosition pos)Parses text from a string to produce a Date.

Calendar类

常用的构造方法
构造方法构造方法描述(原文)-JDK1.8
protected Calendar()Constructs a Calendar with the default time zone and the default FORMAT locale.
常用的方法
方法名称方法描述(原文)-JDK1.8
static Calendar getInstance()Gets a calendar using the default time zone and locale.
void set(int field, int value)Sets the given calendar field to the given value.
int get(int field)Returns the value of the given calendar field.
abstract void add(int field, int amount)Adds or subtracts the specified amount of time to the given calendar field, based on the calendar’s rules.

System类

常用的方法
方法名称方法描述(原文)-JDK1.8
static void arraycopy(Object src, int srcPos, Object dest, int destPos, int length)Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
static void gc()Runs the garbage collector.
static long currentTimeMillis()Returns the current time in milliseconds.
static void exit(int status)Terminates the currently running Java Virtual Machine.

Array类

常用的方法
方法名称方法描述(原文)-JDK1.8
static String toString(int[] a)Returns a string representation of the contents of the specified array.
static int binarySearch(int[] a, int key)Searches the specified array of ints for the specified value using the binary search algorithm.
static void sort(int[] a)Sorts the specified array into ascending numerical order.

Math类

常用的方法
方法的名称方法描述(原文)-JDK1.8
static int abs(int a)Returns the absolute value of an int value.
static double ceil(double a)Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
static double floor(double a)Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.
static int max(int a, int b)Returns the greater of two int values.
static int min(int a, int b)Returns the smaller of two int values.
static double pow(double a, double b)Returns the value of the first argument raised to the power of the second argument.
static double random()Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
static int round(float a)Returns the closest int to the argument, with ties rounding to positive infinity.
static double sqrt(double a)Returns the correctly rounded positive square root of a double value.

基本包装类

基本包装类部分是对基本类型的包装: Byte, Short, Integer, Long, Float, Double, Boolean, Character.

Integer类
常用构造方法
构造方法构造方法描述(原文)-JDK1.8
Integer(int value)Constructs a newly allocated Integer object that represents the specified int value.
Integer(String s)Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.
常用的方法
方法名称方法描述(原文)-JDK1.8
static String toBinaryString(int i)Returns a string representation of the integer argument as an unsigned integer in base 2.
static String toHexString(int i)Returns a string representation of the integer argument as an unsigned integer in base 16.
static String toOctalString(int i)Returns a string representation of the integer argument as an unsigned integer in base 8.
static String toString(int i, int radix)Returns a string representation of the first argument in the radix specified by the second argument.

异常处理

定义

在运行过程中, 代码出现了可控范围外的操作, 这种操作如果可以进行过处理, 那么我们称之为异常处理.

如何处理异常

try…catch操作

try{
	可能会出现的异常代码;
}catch(异常的类名 变量名){
	处理方法;
}finally{
	执行代码;
}

正则表达式

此部分参见教程: 正则表达式30分钟入门教程

其他

== 与 equals方法的区别

==对于基本类型进行值比较, 对于引用类型进行地址比较.

equals()则只能对引用类型使用, 对String其进行了重写比较两个字符串序列是否相等, 默认情况下也是比较对象的地址值.

intern()方法

String s = new String("a") + new String("b");
s.inter();
String str = "aa";
System.out.println(s == str);

请问上述代码的结果是true还是false?

问题解答

此问题与Java的版本有关, 如果是1.7以后版本会返回true, 否则会返回false, 产生这个问题的原因是因为java内部对常量池的位置进行了更改, 1.6版本常量池放在perm区, 而perm区和堆区是分开的, 而在1.7中已经从perm当中移动到了堆区, 1.6中是直接将字符串复制到常量池并返回引用, 而1.7则是将相同的字符串实例引用添加到常量池当中, 不进行复制, 直接返回引用.

关于我

我的Github: PorterZhang2021
我的博客地址:PorterZhang

保姆级教程:在RK3588 Android12设备树(DTS)中配置MIPI 8 Lane双通道与DSC显示 本文详细介绍了在RK3588 Android12平台上配置MIPI 8 Lane双通道与DSC显示的实战指南。通过设备树(DTS)参数详解、DSC参数计算与PPS配置、双通道同步机制实现等内容,帮助开发者高效完成高分辨率屏幕驱动配置,解决嵌入式显示系统开发中的常见挑战。 阅读详情

相关推荐

在F1C100s上跑GBA游戏:手把手教你用Buildroot配置SDL和移植gpsp模拟器

本文详细介绍了在全志F1C100s开发板上配置Buildroot、移植SDL库和gpsp模拟器的完整流程,帮助开发者实现在ARM9平台上流畅运行GBA游戏。内容涵盖环境配置、交叉编译、常见问题解决及性能优化技巧,特别针对'段错误'和'无声音'等典型问题提供实用解决方案。

weixin_42566424的博客 397

JavaSE学习笔记 Day6

方法

CHiN_951的博客 1016

【R语言-生存分析之观察生存率计算】

全人群肿瘤登记资料常用的统计分析指标包括发病率、死亡率、现患率以及生存率等,其中肿瘤生存率是评估肿瘤治疗效果和肿瘤负担的必要指标,其计算涉及肿瘤患者的发病、 死亡和随访三个方面的资料, 数据整理和计算过程均较为复杂, 如何及时、 准确地计算肿瘤生存率, 并使其可以在不同地区、 不同人群、不同时期间被客观公正地比较和评价,仍然是统计学家们一直在研究的主题。

weixin_46579654的博客 5439

[JAVASE]笔记6

可变参数: 参数的个数不确定,可以是0个可以是多个,参数的数据类型必须相同 可变参数必须要写在参数列表的最后 … ,数据类型 … 参数名–>可变参数 操作可变参数,要通过使用数组的方式,编译器会隐式的在内部为我们构建一个数组,存储可变参数的值 数组排序 数组: int[] arr={9,10,5,7,4} 冒泡排序: 每两个相邻数之间进行比较,找到一个最小的或者最大的进行交换,把...

bkdl047的博客 151

68页|大型车企集团数字化转型汽车数字化信息系统平台规划方案

这份PPT文档提供了一个全面的汽车集团数字化转型规划方案,涵盖了项目目标、规划思路、实施关注点、解决方案建议以及合作优势等多个方面。

baidu_25525561的博客 1328

《Ventoy 制作系统安装 U 盘的具体步骤》

然后您可以在电脑的磁盘管理中对 U 盘进行快速格式化,选择 FAT32 或 NTFS 文件系统。至此,Ventoy 系统安装 U 盘就制作完成了。您可以在需要安装系统的电脑上,从 U 盘启动,然后选择相应的系统镜像进行安装。安装完成后,将您需要的操作系统镜像文件(如 Windows、Linux 等的 ISO 格式镜像)复制到 U 盘的根目录。在安装程序中,选择您插入的 U 盘设备,确保选择正确,以免误操作。2. 确认选择的 U 盘盘符正确,防止误操作导致其他磁盘数据丢失。点击“安装”按钮,等待安装完成。

jiyiwangluokeji的博客 2667

【JavaSE韩顺平学习笔记】6. 数组

第一章 Java概述第二章 常规操作和DOS第三章 变量第四章 运算符,标识符第五章 程序控制结构第六章 数组。

qq_53479519的博客 361

ZYNQ专题-7020驱动KSZ9031 PHY芯片

之所以有这篇文章,得益于Alinx的开发板。

Anitawen的博客 4965

JAVASE第6天笔记

Day06 课堂笔记标签(空格分隔): java基础阶段总结+往后学习大纲 1,java语法知识(1-5)day01 计算机软件硬件 安装JDK和配置环境变量 java概述 写了小程序HelloWorld 注释 关键字 标识符 day02 常量 进制(原反补) 变量 数据类型 类型转换 运算符 day03 运算符 Scanner屏幕录入对象 流

baidu_36439112的博客 321

手搓ZLMediaKit实现拉流推流系列3(RK3588上YOLO系列拉流、MPP解码+编码、推流全流程)

 前段时间比较忙,一直没有时间补充后续的内容。今天终于抽出空来,立马进入码字环节:手搓ZLMediaKit实现拉流推流系列在本篇也终于迎来了完结篇,在本篇文章中,你将看到以下一整套完整流程:使用ZLMediaKit拉流---MPP解码---Yolo模型进行推理---MPP编码并推流。

m0_46303486的博客 2173

MPU6050数据融合避坑指南:当欧拉角遇到万向节死锁,我们该如何处理?

本文深入探讨了MPU6050在姿态解算中遇到的欧拉角万向节死锁问题,提供了四元数解决方案及工程实践策略。通过分析死锁现象的本质,介绍四元数的优势与实现方法,并给出必须使用欧拉角时的三种应对方案,帮助开发者有效规避数据跳变和解算失效问题。

weixin_30415113的博客 541

JavaSe第6次笔记

1.不建议使用c语言的数组的表示方法。 2.二维数组表示方法 3.数组整体初始化时,只能在定义时初始化。 int[] array; array = new int[]{1, 2}; 4. boolean类型数组,默认值是false,String类型数组,默认是null,其它是0(不是随机值)。 5. array.length直接拿到数组的长度。 6.打印数组的第二种方法 for(int x : array) { sout(x); } 7.打印数组的第三种方法: s

m0_73345579的博客 871

最优化理论与自动驾驶(三):LQR原理、公式及代码演示

LQR 是基于线性系统和二次型代价函数的最优控制方法,在实际工程应用中,我们一般采用离散时间系统的LQR设计,其目标是通过设计反馈控制律,使系统在离散时间步长内稳定运行,最小化某个二次型代价函数。给定一个离散时间系统,其状态和控制输入通过以下方程表示:是时刻k的系统状态,是时刻k的控制输入,是状态转移矩阵,是输入矩阵。系统描述的物理意义:系统状态通过矩阵A演变到下一时刻,同时控制输入通过矩阵B影响系统的状态。

a8598671的博客 4595

JavaSE学习笔记 6

前面了解了接口、抽象类,下面就可以简单的了解一下几个常用的接口了,这里又涉及java的公共父类Object。

Ahiansizuku的博客 128

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

JavaSe笔记3.6

JavaSe笔记3.6

ZeroSeal的博客 109

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

JavaSE基础听课笔记Day6

内容 06 常用类 Notes String类举例 - ppt4 + 6 + 8 String.valueOf(Object obj)返回的是对象obj的toString方法的值 - TestDateSort.java valueOf方法调用时存在多态:1. 存在对于object的继承;2. 子类重写了toString方法;3. 父类Object指向了子类的对象 valueOf+split方法 ...

Renoler的博客 146

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

Javase学习笔记6

int a[] = new int{1,2,3} 写法错误 int a[] = new int[]{1,2,3} 写法正确。二维数组的声明int b[][] int[][] b int[] b[]使用方式3:静态初始化 int b[][]={{3,5,6},{5,8,3}}数组存在栈里的是地址,地址指向堆里的数据空间,数组进行拷贝的时候,拷贝的是地址。使用方式1:动态初始化 int b[][]=new int[2][3]

weixin_47312413的博客 64

JavaSE学习笔记-Day6

昨天学完了面向对象的进阶内容,不过对面向对象还是没有什么感觉啊,不敢那么多了,继续往后学!今天我们学习一下数组。 一. 一维数组 数组这个概念就不陌生了,就不做实例来引进概念了。 数组是相同类型数据的有序集合。其中,每一个数据称作一个元素,每个元素可以通过一个索引(下标)来访问它们。 数组的几大特点: 长度是确定的。数组一旦被创建,它的大小就是不可以改变的。 其元素必须是相同类型,不允许出现...

weixin_44170240的博客 289

javaSE学习笔记6 重写

java中的子类是不能获得父类的构造器的 java中子类重写(也叫覆盖Overrider)父类的方法:子类继承了父类,但是父类的方法不太适合子类,所以子类可以重写父类的方法。重写遵循“两同两小一大”规则:两同就是方法名、形参列表相同,两小就是子类的返回值必须比父类的相等或者比父类的小。子类方法声明抛出的异常应该比父类的更小或者相等。一大是指子类方法的访问权限应该比父类的方法的访问权限更大。 重

921800467的专栏 625

JavaSE高级开发核心笔记6

本文介绍了反射和设计模式的核心概念。反射通过类对象操作类信息,提供三种获取类对象的方式,支持动态创建对象和调用方法(包括私有方法),具有灵活性但会降低可读性。设计模式部分重点讲解单例模式的三种实现:饿汉式(线程安全但资源占用高)、懒汉式(延迟加载但效率低)和推荐的静态内部类式(兼顾线程安全和高效)。此外还介绍了工厂模式通过反射和Properties类读取配置文件来降低耦合,以及Properties类的特性与核心方法。这些技术为框架开发提供了灵活通用的解决方案。

Jessica_531的博客 332

JavaSE自学笔记(6)

数组:元素的线性集合; 1.数组的定义初始化与赋值; 2.数组的两种遍历方法 3.使用Arrays类种常见的方法; 4.自写toString,copyOf,copyOfRange,冒泡排序,二分查找;

sadnjkjn的博客 101

JavaSE6.0 Web Service学习笔记

http://www.javaeye.com/topic/166314?page=1一篇介绍webservice好文 感谢文作者linliangyi2007 相关文章:   使用 WSDL4J 创建 WSDL 实战WebService II: SOAP篇(基于php) web service框架---axis学习笔记 推荐圈子: WebServices 更多相关推荐

杨德龙的专栏 1534

JAVASE学习笔记第6天

面向对象(static关键字)(不熟悉) 1、静态:static 2、用法:是一个修饰符,由于修饰成员(成员变量,成员方法),被static修饰的成员,会在方法区中存在,且所有的对象都具有。可以使用:类名.成员调用 3、static的特点: l  生命周期: 随着类的加载而加载,随着类的消失而消失 l  优先于对象存在: 被静态修饰的成员是先存在的,而对象时候存在的。 l  被多

小时 250

javaSE关于TreeSet的笔记(6)

package collection; import java.util.Comparator; import java.util.TreeSet; public class TreeSetTest06 { public static void main(String[] args) { // 创建TreeSet集合的时候,需要使用这个比较器 // 必须传进去一个比较器 TreeSet<WuGui> wuGuis = new Tree.

qq_57858143的博客 124

JAVASE基础知识笔记6

  JAVA SE Lesson 1 1.  类是一种抽象的概念,对象是类的一种具体表示形式,是具    体的概念。先有类,然后由类来生成对象(Object )。对象又     叫做实例(Instance)。 2.  类由两大部分构成:属性以及方法。属性一般用名词来表示,    方法一般用动词来表示。 3.  如果一个java         源文件中定义了多个类,那么这些...

ycxyyzw的专栏 172

javaSE关于集合的笔记(6)

package collection; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; public class CollectionTest06 { public static void main(String[] args) { // 创建集合 Collection c = new ArrayList(); // it中无.

qq_57858143的博客 176
上一篇: JavaSE总结笔记-5
下一篇: javaSE总结笔记-7
PorterZhang2021
博客等级 码龄4年 27粉丝 25原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值