java问题
编写一个Java应用程序,实现如下功能:1)判断两个字符串是否相同,s1=”youareastudent”,s2=”howareyou”;2)判断字符串”22030219...
编写一个Java应用程序,实现如下功能:
1)判断两个字符串是否相同,s1=”you are a student”,s2=”how are you”;
2)判断字符串”22030219851022024”的前缀、后缀是否和某个字符串”220302”相同;
3)按字典顺序比较两个字符串”你”和”我”的大小关系;
4)将数字型字符串”100”和”123.678”转换为数字;
5)将字符串”FEDCBA”存放到数组中,调用for循环读出数组数据显示在屏幕上。 展开
1)判断两个字符串是否相同,s1=”you are a student”,s2=”how are you”;
2)判断字符串”22030219851022024”的前缀、后缀是否和某个字符串”220302”相同;
3)按字典顺序比较两个字符串”你”和”我”的大小关系;
4)将数字型字符串”100”和”123.678”转换为数字;
5)将字符串”FEDCBA”存放到数组中,调用for循环读出数组数据显示在屏幕上。 展开
2个回答
2009-09-30
展开全部
public class Test {
public static void main(String[] args) {
String s1 = "you are a student", s2 = "how are you";
System.out.println(s1.equals(s2));
System.out.println("22030219851022024".startsWith("220302"));
System.out.println("22030219851022024".endsWith("220302"));
System.out.println("你".compareTo("我"));
System.out.println(Integer.parseInt("100"));
System.out.println(Double.parseDouble("123.678"));
char[] c = "FEDCBA".toCharArray();
System.out.println(java.util.Arrays.toString(c));
}
}
public static void main(String[] args) {
String s1 = "you are a student", s2 = "how are you";
System.out.println(s1.equals(s2));
System.out.println("22030219851022024".startsWith("220302"));
System.out.println("22030219851022024".endsWith("220302"));
System.out.println("你".compareTo("我"));
System.out.println(Integer.parseInt("100"));
System.out.println(Double.parseDouble("123.678"));
char[] c = "FEDCBA".toCharArray();
System.out.println(java.util.Arrays.toString(c));
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询