You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
599 B
599 B
Q:
1.JAVA输入操作 2.JAVA创建函数 3.JAVA怎么输入比如36.6 C 4.sc.next().charAt(0)是什么意思?
A:
1.最常用:Scanner 输入 2.Java 里叫方法(Method),其实就是你说的函数 修饰符 返回值类型 方法名(参数列表) { // 代码 return 返回值; } 3.nextDouble() 读数字 next().charAt(0) 读第一个字符(C/F) 4. sc.next()
- 读取一个单词/一段不带空格的字符串
- 比如你输入: C 或 F ,它就读到 "C" 、 "F"
charAt(0)
- 取这个字符串里第 0 个字符
- 字符串的位置是 从 0 开始数