import java.io.*;public class test{
public static void main(String args[]){
String a="asdw";
String b="asdw";
String cc;
cc=a+"."+b;
System.out.println(cc);
}
}用个循环应该可以了吧

解决方案 »

  1.   

    楼上的兄弟可以么??
    我觉得还是应该用StringBuffer的Append方法。
      

  2.   

    呵呵:)
    别忘了给分哦,总不给分以后就没有人答咯。
    当使用“+”操作符进行String对象连接时,编译器就是在内部用StringBuffer来实现连接的。
    StringBuffer的Append方法也可以连接多个。
    如:
      StringBuffer buf = new StringBuffer();
      buf.append("hehe").appent("haha"); //buf等于"hehehaha"我想楼主rainbow2k (rainbow) 的意思是实现一个字符串
    如: "one two there four" 其中的分隔可以是空格也可以是","等其他字符那么你就可以使用StringTokenizer类。
      StringTokenizer st = new StringTokenizer("one two there four");
    可以用nextElement方法或nextToken方法来查找分隔标记。nextElement方法返回一个对象,而nextToken方法返回字符串。
    使用如:
      String token = st.nextToken();
    使用while遍例,如:
      while(tk.hasMoreTokens()){
        String token = st.nextToken();
      }
    调用coutTokens确定有多少个标记。
    public StringTokenizer(String str,
                           String delim,
                           boolean returnDelims)
    Constructs a string tokenizer for the specified string. All characters in the delim argument are the delimiters for separating tokens. 
    If the returnDelims flag is true, then the delimiter characters are also returned as tokens. Each delimiter is returned as a string of length one. If the flag is false, the delimiter characters are skipped and only serve as separators between tokens. public StringTokenizer(String str,
                           String delim)
    Constructs a string tokenizer for the specified string. The characters in the delim argument are the delimiters for separating tokens. Delimiter characters themselves will not be treated as tokens. public StringTokenizer(String str)
    Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is " \t\n\r\f": the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens. 有如上三个构造方法。
    public boolean hasMoreTokens()
    Tests if there are more tokens available from this tokenizer's string. If this method returns true, then a subsequent call to nextToken with no argument will successfully return a token. Returns:
    true if and only if there is at least one token in the string after the current position; false otherwise.--------------------------------------------------------------------------------
    public String nextToken()
    Returns the next token from this string tokenizer. Returns:
    the next token from this string tokenizer. 
    Throws: 
    NoSuchElementException - if there are no more tokens in this tokenizer's string.--------------------------------------------------------------------------------nextToken
    public String nextToken(String delim)
    Returns the next token in this string tokenizer's string. First, the set of characters considered to be delimiters by this StringTokenizer object is changed to be the characters in the string delim. Then the next token in the string after the current position is returned. The current position is advanced beyond the recognized token. The new delimiter set remains the default after this call. Parameters:
    delim - the new delimiters. 
    Returns:
    the next token, after switching to the new delimiter set. 
    Throws: 
    NoSuchElementException - if there are no more tokens in this tokenizer's string.--------------------------------------------------------------------------------hasMoreElements
    public boolean hasMoreElements()
    Returns the same value as the hasMoreTokens method. It exists so that this class can implement the Enumeration interface. Specified by:
    hasMoreElements in interface Enumeration
    Returns:
    true if there are more tokens; false otherwise.
    See Also:
    Enumeration, hasMoreTokens()--------------------------------------------------------------------------------nextElement
    public Object nextElement()
    Returns the same value as the nextToken method, except that its declared return value is Object rather than String. It exists so that this class can implement the Enumeration interface. Specified by:
    nextElement in interface Enumeration
    Returns:
    the next token in the string. 
    Throws: 
    NoSuchElementException - if there are no more tokens in this tokenizer's string.
    See Also:
    Enumeration, nextToken()--------------------------------------------------------------------------------countTokens
    public int countTokens()
    Calculates the number of times that this tokenizer's nextToken method can be called before it generates an exception. The current position is not advanced. Returns:
    the number of tokens remaining in the string using the current delimiter set。
    有如上六个方法。上面的delim参数是指分隔符。
      

  3.   

    都行,StringBuffer效率高些而已