日期:2014-05-20  浏览次数:20823 次

下面这段程序,有哪些行是不符合java编程规范的?
/**   
* Sample application using the simple text editor component that   
* supports only one font.   
* @author Timothy Prinzing   
* @version 1.16 09/23/99   
*/     

package MyProject.theFirstApp;
   class notepad extends JPanel {    
  final int MAX_NUM=1000;    
  final long rate=999;    
  String STR;    
  char theFirstcharacter;    
  public static void main(String[] args) {    
  try {    
  String vers = System.getProperty("java.version");    
  if (vers.compareTo("1.1.2") < 0) { ......}   
  }      
  private Component CreateToolbar() {   ......   }  
  }


------解决方案--------------------
包 类 变量 方法命名
有try没catch。
等等
------解决方案--------------------
包名全部都要用小写

类名都是大写字母开头,后面的每个单词首字母大写,其它字母小写,如果有一部分是缩写,如"HTML"、"URL"等等,则全部大写


------解决方案--------------------
类名首字母大写,方法名第一个单词的首字母小写,其他的单词首字母大写
------解决方案--------------------
private Component CreateToolbar()这句话不知道你是什么意思?还有就是try要和catch一起使用不能单个出来
string STR 没有被初始化,不存在吧 ?