Java语言程序设计基础篇_第十版_梁勇_4.20字符串处理课后答案
package nameyu;import java.util.Scanner;public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); System.out.print("Enter a string:"); String numbers=input.nextLine(); int l=numbers.length(); char ch=numbers.charAt(0); System.out.println("length :"+l); System.out.println("first character :"+ch); }}
页:
[1]