码迷,mamicode.com
首页 > 其他好文 > 详细

String

时间:2014-07-16 18:44:10      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   for   io   div   

 1 package pro1;
 2 
 3 public class Pro1 {
 4 
 5     public static void main(String[] args) {
 6         // TODO code application logic here
 7         System.out.println("test");
 8         //ask for the word‘s length
 9         String s="welcome to beijin";
10         int len=s.length();
11         System.out.println(len);
12         //concat
13         String str="peggy";
14         System.out.println(s.concat(str));
15         str=str+s;
16         System.out.println(str);
17               
18       String s1="This" ;
19       String s2="That";
20       System.out.println("Result 1:"+s1.equals("this")+","+s1.equalsIgnoreCase("this"));
21       System.out.println("Result 2:"+s2.compareTo("That")+s2.compareTo(s1)+s2.compareTo("that"));
22        // if it return -32 states : "That"is smaller than "this"(T<t) only both they are same return 0;m                                                                                   23         
24     }
25 }

 

 

String,布布扣,bubuko.com

String

标签:style   blog   color   for   io   div   

原文地址:http://www.cnblogs.com/zzblee/p/3845107.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!