程序要求输从键盘入一个字符串打印它的长度, 大家帮忙看看下面该这么写啊 谢谢
public class Main {
public static void main(String[] args) {
System.out.print("输入:");
Scanner in = new Scanner(System.in);
String s = in.nextLine();
System.out.print(s+"s.length = " + s.length()); }
}
public class Main {
public static void main(String[] args) {
System.out.print("输入:");
Scanner in = new Scanner(System.in);
String s = in.nextLine();
System.out.print(s+"s.length = " + s.length()); }
}
解决方案 »
- 在JDK1.1中Thread类定义了suspend()和resume()方法,但是在JDK1.2中已经过时,应使用什么方法来替代之?
- Oracle数据库,JDBC访问,字段类型是DATE,PreparedStatement里用setTimestamp还是setDate?
- 类 传递参数的方式,值传递还是地址传递呢?
- RE: JScrollPane滚动条位置问题?
- 如何用JAVA来访问XML并对里面的值进行操作呀???
- 请教一个Java的Swing监视器问题.
- petstore这个例子怎么看呀,感觉没有头绪,好象bea公司打包打的不对呀,都有重复的,请分析过petstore的大侠指点小弟一下。
- 如何让CORE JAVA卷2中的第四章“数据库连接”的示例运行起来?
- 有没有jdk的高手
- jxl 这样为什么读取不了表格
- static的本质是什么,有关它本质的一切都可回答,谢谢了
- 谁知道怎样给jfreechart的SpiderWebPlot(蜘蛛网图)加上了刻度和刻度标签?
import java.util.*;
public class Array1 {
public static void main(String[] args) {
System.out.print("输入:");
Scanner in = new Scanner(System.in);
while(in.hasNextLine()){
String s = in.nextLine();
System.out.println(s+" "+"s.length = " + s.length());
}
}
}
import java.util.*;