| 本帖最后由 小石姐姐 于 2018-1-25 09:30 编辑 
 文本域input的不可编辑属性 disabled 和  readonly  区别
 都可以实现都可以实现input的不可编辑,但有区别
 disable 属性 -- 表示已经失效的输入域
 readonly 属性 -- 表示只读(只能看到,不能修改)的输入域(框)
 
 <input type="checkbox" value="2"  name="fav" disabled="disabled" />    <input type="text"  name="notinput" readonly="readonly" />  
 File协议 表示本地文件传输协议,File协议主要用于访问本地计算机中的文件 ,就如同在Windows资源管理器中打开文件一样。
  应用:要使用File协议,基本的格式如下:file:///文件路径,比如要打开F:盘flash文件夹中的1.swf文件,那么可以在资源管理器或IE地址栏中键入:file:///f:/flash/1.swf并回车。 3个斜杠代表本地 什么时候用Thread.getContextClassLoader()     需要动态加载很多类和资源的时候 .      通常当你需要动态加载资源的时候 , 你至少有三个 ClassLoader 可以选择 :         系统类加载器或叫作应用类加载器 (system classloader or application classloader)         当前类加载器         当前线程类加载器 instanceof 运算符 指出对象是否是特定类的一个实例。
 String s = "I AM an Object!";  boolean isObject = s instanceof Object;    public double calculate(Bill bill) {  if (bill instanceof PhoneBill) {//计算电话账单  }  }  
 
 java环境配置(都放下面): CLASSPATH   .;%JAVA_HOME%\lib JAVA_HOME   C:\Program Files\Java\jdk1.6.0_22 Path  .;%JAVA_HOME%\bin JDK1.5的新特性 “JDK1.5”(开发代号猛虎)的一个重要主题就是通过新增一些特性来简化开发 ,这些特性包括泛型,for-each循环,自动装包/拆包,枚举,可变参数, 静态导入 。使用这些特性有助于我们编写更加清晰,精悍,安全的代码。 自动装包/拆包 自动装包/拆包大大方便了基本类型数据和它们包装类地使用。自动装包:基本类型自动转为包装类.(int >> Integer)
 自动拆包:包装类自动转为基本类型.(Integer >> int)
 在JDK1.5之前,我们总是对集合不能存放基本类型而耿耿于怀,现在自动转换机制解决了我们的问题。
 在实际开发过程中,我们经常会遇到需要使用对象,而不是内置数据类型的情形。为了解决这个问题,Java语言为每一个内置数据类型提供了对应的包装类。 所有的包装类(Integer、Long、Byte、Double、Float、Short)都是抽象类Number的子类。 这里Integer先自动转换为int进行加法运算,然后int再次转换为Integer. 枚举:int a = 3;  Collection c = new ArrayList();  c.add(a);//自动转换成Integer.    Integer b = new Integer(2);  c.add(b + 2);  
 
 
 然后可以这样来使用Color myColor = Color.Red.public enum Color  {     Red,     White,     Blue  }  
 
 枚举类型还提供了两个有用的静态方法values()和valueOf(). 我们可以很方便地使用它们,例如
 
 
 带构造函数的枚举:for (Color c : Color.values())     System.out.println(c);  
 
 
 public enum Color {    RED("红色"),BLUE("蓝色"),GREEN("绿色");        private final String name;    public  String getName() {  return name;      }  private Color(String name){  this.name=name;      }  }  
 
 System.out.println("Color.RED.name():"+Color.RED.name());         //RED  System.out.println("Color.RED.toString():"+Color.RED.toString()); //RED  System.out.println(Color.RED.getName());    //红色  
 
  Color.RED.name()  Color.RED.toString(); 得到的都是RED 1、Color枚举类是特殊的class,其枚举值(RED,BLUE...)是Color的类对象(类实例):Color c=Color.RED ;而且这些枚举值都是public static final的,也就是我们经常所定义的常量,因此枚举类中的枚举值最好全部大写 。
 2、即然枚举类是class,当然在枚举类型中有构造器,方法和数据域。但是,枚举类的构造器有很大的不同:
 (1) 构造函数只是在构造枚举值的时候被调用。
 (2) 枚举构造函数只能私有private ,绝对不允许有public构造器。这样可以保证外部代码无法新构造枚举类的实例。因为我们知道枚举值是public static final的常量而已 但枚举类的方法和数据域可以允许外部访问。
 /**  *   * 服务器类型  *   */  public enum ServerType {        JBoss("server/default/deploy","client,common"), WebLogic("",""), GlassFish("","");        private String deployPath;        private String libClassPath;        private ServerType(String deployPath, String libClassPath){  this.deployPath = deployPath;  this.libClassPath = libClassPath;      }        public String getDeployPath(){  return this.deployPath;   }        public String getLibClassPath(){  return this.libClassPath;  }  }  
 
 ServerType serverType = ServerType.JBoss; String deployPath = serverType.getDeployPath();String libClassPath = serverType.getLibClassPath();
 
 
 
 
 |