public enum Weather{ Sunny,Rainy,Cloudy}
public String toString(){
return ; //这里怎么写才能输出是 Sunny或Rainy或Cloudy呢?
}
public enum Weather{ Sunny,Rainy,Cloudy}
public String toString(){
return ; //这里怎么写才能输出是 Sunny或Rainy或Cloudy呢?
}
收起
http://ideone.com/6ghz84
Sunny
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public enum Weather{ Sunny,Rainy,Cloudy}
public static void main (String[] args) throws java.lang.Exception
{
// your code goes here
String s = Weather.Sunny.toString();
System.out.println(s);
}
}
报告相同问题?