input.nextLine() 和input.next()
1.next()方法在读取内容时,会过滤掉有效字符前面的无效字符,对输入有效字符之前遇到的空格键、Tab键或Enter键等结束符,next()方法会自动将其过滤掉;只有在读取到有效字符之后,next()方法才将其后的空格键、Tab键或Enter键等视为结束符;所以next()方法不能得到带空格的字符串。2.nextLine()方法字面上有扫描一整行的意思,它的结束符只能是Enter键,即nextL
1.next()方法在读取内容时,会过滤掉有效字符前面的无效字符,对输入有效字符之前遇到的空格键、Tab键或Enter键等结束符,next()方法会自动将其过滤掉;只有在读取到有效字符之后,next()方法才将其后的空格键、Tab键或Enter键等视为结束符;所以next()方法不能得到带空格的字符串。2.nextLine()方法字面上有扫描一整行的意思,它的结束符只能是Enter键,即nextL
substring(a, b)表示截取下标从a开始到b结束的字符,包含第a个字符但是不包含第b个字符,可以看成[a,b)。例如0x12, substring(2,length) = 12;字符串从0开始到字符串长度结束(因为取不到长度)
Scanner scanner = new Scanner(System.in); int input = Integer.parseInt(scanner.next()); int y = input; int result = 0; while(input != 0){ result = result*10 + input%10; input = input/10; }
public class getLastDamager { public static Entity getLastDamager(Entity entity) { EntityDamageEvent event = entity.getLastDamageCause(); if (event != null && !event.isCanc
public static Entity getNearestEntityInSight(Player player, int range) {ArrayList<Entity> entities = (ArrayList<Entity>) player.getNearbyEntities(range, range, range); ArrayList<Block&g