摘要:
##案例演示 需求 已知String str = "this is a text"; 1.将str中的单词单独获取出来 2.将str中的text替换为practice 3.在text前面插入一个easy 4.将每个单词的首字母改为大写 public class Demo4 { public stat 阅读全文
posted @ 2022-01-13 21:22
摘星丶仙
阅读(25)
评论(0)
推荐(0)
摘要:
常用方法 public int length():返回字符串的长度。 public char charAt(int index):根据下标获取字符。 public boolean contains(String str):判断当前字符串中是否包含str。 //字符串方法的使用 //1、length( 阅读全文
posted @ 2022-01-13 20:44
摘星丶仙
阅读(26)
评论(0)
推荐(0)
摘要:
String 字符串是常量,创建之后不可改变。 字符串字面值存储在字符串池中,可以共享。 public class Demo3{ public static void main(String[] args){ String name = "hello";//"hello" 常量存储在字符串池中 na 阅读全文
posted @ 2022-01-13 19:48
摘星丶仙
阅读(51)
评论(0)
推荐(0)
摘要:
整数缓冲区 Java预先创建了256个常用的整数包装类型对象。 public class Demo2{ public static void main(String[] args){ //面试题 Integer integer1 = new Integer(100); Integer integer 阅读全文
posted @ 2022-01-13 19:25
摘星丶仙
阅读(24)
评论(0)
推荐(0)
摘要:
类型转换与装箱、拆箱 8种包装类提供不同类型间的转换方式: Number父类中提供的6个共性方法。 public class Demo1{ public static void main(String[] args){ //类型装换:装箱,基本类型转成引用类型的过程。 //基本类型 int num1 阅读全文
posted @ 2022-01-13 15:08
摘星丶仙
阅读(29)
评论(0)
推荐(0)

浙公网安备 33010602011771号