先看解释: nextInt(): it only reads the int value, nextInt() places the cursor in the same line after reading the input. next(): read the input only till the space. It can't read two words separated by space. Also, next() places the cursor in the same lin
这个课程的参考视频和图片来自youtube. 主要学到的知识点有: We want to handle the bad Error. (e.g bad input / bugs in program) 1. File() : A Java representation of a file. File file = new File("test.txt"); 2. PrintWriter() : Write to a file. Write string into the file. /
代码: package com.ins1; import java.util.*; public class test { public static void main(String[] args){ Scanner input = new Scanner(System.in); int n=input.nextInt(); String[] str = new String[n]; for(int i=0;i<n;i++){ str[i]=input.nextLine(); } for (i
建议56:自由选择字符串拼接方法 对一个字符串拼接有三种方法:加号.concat方法及StringBuilder(或StringBuffer ,由于StringBuffer的方法与StringBuilder相同,不在赘述)的append方法,其中加号是最常用的,其它两种方式偶尔会出现在一些开源项目中,那这三者之间有什么区别吗?我们看看下面的例子: public class Client56 { public static void main(String[] args) { // 加号拼接 St
1. 本周学习总结 以你喜欢的方式(思维导图或其他)归纳总结集合相关内容. 使用工具:百度脑图 2. 书面作业 1.ArrayList代码分析 1.1 解释ArrayList的contains源代码 contains部分源代码: public boolean contains(Object o) { return indexOf(o) >= 0; } public int indexOf(Object o) { if (o == null) { for (int i = 0; i < size