java常用的的类方法有哪些
时间: 2023-11-17 12:07:33 浏览: 31
Java中常用的类方法有很多,这里只列举一些比较常用的类方法:
1. String类方法:charAt()、length()、substring()、equals()、indexOf()、split()、toLowerCase()、toUpperCase()、trim()等。
2. Math类方法:abs()、ceil()、floor()、max()、min()、pow()、random()、round()等。
3. Arrays类方法:sort()、binarySearch()、equals()、fill()、copyOf()等。
4. ArrayList类方法:add()、remove()、get()、set()、size()等。
5. HashMap类方法:put()、get()、remove()、containsKey()、containsValue()等。
6. File类方法:exists()、getName()、getParent()、isDirectory()、isFile()、length()等。
7. Date类方法:getTime()、toString()、compareTo()、equals()等。
8. System类方法:out.println()、currentTimeMillis()、getProperty()、getenv()等。
相关问题
JAVA File类的常用方法有哪些?
JAVA File类是用于操作文件和目录的类,常用的方法有:
1. File(String pathname):根据指定的路径名创建一个File对象。
2. exists():测试此抽象路径名表示的文件或目录是否存在。
3. isFile():测试此抽象路径名表示的文件是否是标准文件。
4. isDirectory():测试此抽象路径名表示的文件是否是目录。
5. getName():返回由此抽象路径名表示的文件或目录的名称。
6. getParent():返回此抽象路径名父目录的路径名字符串,如果此路径名没有指定父目录,则返回 null。
7. length():返回由此抽象路径名表示的文件的长度。
8. list():返回此抽象路径名表示的目录中的文件和目录的名称字符串数组。
9. mkdir():创建此抽象路径名指定的目录。
10. delete():删除此抽象路径名表示的文件或目录。
11. renameTo(File dest):将此抽象路径名表示的文件重命名为指定的文件路径名。
12. getAbsolutePath():返回此抽象路径名的绝对路径名字符串。
java String类有哪些常用的方法
Java String类的常用方法包括:length()、charAt()、substring()、equals()、equalsIgnoreCase()、indexOf()、lastIndexOf()、replace()、trim()、toLowerCase()、toUpperCase()、startsWith()、endsWith()、concat()、split()等。