為什么輸入的字符串無法識別
package com.imooc2;
import java.util.Scanner;
public class Initail2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
? System.out.println("請輸入形狀:");
? Scanner s = new Scanner(System.in);
? String str = null;
? str = s.next();
? if(str=="圓形") {
? shape shape1=new circle();
? shape1.girth();
? }
? else if(str=="矩形"){
? shape shape2=new rectangle();
? shape2.girth();}
? else{
? System.out.println("請輸入圓形或矩形");
? }
? System.out.println(str);
?
}
}
運行的時候 輸入 圓形和矩形 不會識別
2015-06-23
有什么錯誤提示嗎?