Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Java this¡¢superµÄÓ÷¨




¡¡
¡¡ÔÚJavaÖУ¬thisͨ³£Ö¸µ±Ç°¶ÔÏó£¬superÔòÖ¸¸¸ÀàµÄ¡£µ±ÄãÏëÒªÒýÓõ±Ç°¶ÔÏóµÄijÖÖ¶«Î÷£¬±ÈÈ統ǰ¶ÔÏóµÄij¸ö·½·¨£¬»òµ±Ç°¶ÔÏóµÄij¸ö³ÉÔ±£¬Äã±ã
¿ÉÒÔÀûÓÃthisÀ´ÊµÏÖÕâ¸öÄ¿µÄ£¬µ±È»£¬thisµÄÁíÒ»¸öÓÃ;Êǵ÷Óõ±Ç°¶ÔÏóµÄÁíÒ»¸ö¹¹Ô캯Êý£¬ÕâЩÂíÉϾÍÒªÌÖÂÛ¡£Èç¹ûÄãÏëÒýÓø¸ÀàµÄijÖÖ¶«Î÷£¬Ôò·Ç
superĪÊô¡£ÓÉÓÚthisÓësuperÓÐÈç´ËÏàËƵÄһЩÌØÐÔºÍÓëÉú¾ãÀ´µÄijÖÖ¹Øϵ£¬ËùÒÔÎÒÃÇÔÚÕâÒ»¿é¶ùÀ´ÌÖÂÛ£¬Ï£ÍûÄÜ°ïÖúÄãÇø·ÖºÍÕÆÎÕËüÃÇÁ½¸ö¡£
ÔÚÒ»°ã·½·¨ÖÐ

¡¡
¡¡×îÆÕ±éµÄÇé¿ö¾ÍÊÇ£¬ÔÚÄãµÄ·½·¨ÖеÄij¸öÐβÎÃûÓ뵱ǰ¶ÔÏóµÄij¸ö³ÉÔ±ÓÐÏàͬµÄÃû×Ö£¬ÕâʱΪÁ˲»ÖÁÓÚ»ìÏý£¬Äã±ãÐèÒªÃ÷ȷʹÓÃthis¹Ø¼ü×ÖÀ´Ö¸Ã÷ÄãҪʹÓÃij
¸ö³ÉÔ±£¬Ê¹Ó÷½·¨ÊÇ“this.³ÉÔ±Ãû”£¬¶ø²»´øthisµÄÄǸö±ãÊÇÐβΡ£ÁíÍ⣬»¹¿ÉÒÔÓÓthis.·½·¨Ãû”À´ÒýÓõ±Ç°¶ÔÏóµÄij¸ö·½·¨£¬µ«Õâʱthis
¾Í²»ÊDZØÐëµÄÁË£¬Äã¿ÉÒÔÖ±½ÓÓ÷½·¨ÃûÀ´·ÃÎÊÄǸö·½·¨£¬±àÒëÆ÷»áÖªµÀÄãÒªµ÷ÓõÄÊÇÄÇÒ»¸ö¡£ÏÂÃæµÄ´úÂëÑÝʾÁËÉÏÃæµÄÓ÷¨£º
public class DemoThis{
  private String name;
  private int age;
  DemoThis(String name,int age){
    setName(name); //Äã¿ÉÒÔ¼ÓÉÏthisÀ´µ÷Ó÷½·¨£¬ÏñÕâÑù£ºthis.setName(name);µ«Õâ²¢²»ÊDZØÐëµÄ
    setAge(age);
    this.print();
  }  
  public void setName(String name){
    this.name=name;//´Ë´¦±ØÐëÖ¸Ã÷ÄãÒªÒýÓóÉÔ±±äÁ¿
  }
  public void setAge(int age){
    this.age=age;
  }
  public void print(){
    System.out.println("Name="+name+" Age="+age);//ÔÚ´ËÐÐÖв¢²»ÐèÒªÓÃthis£¬ÒòΪûÓлᵼÖ»ìÏýµÄ¶«Î÷
  }
  public static void main(String[] args){
    DemoThis dt=new DemoThis("Kevin","22");
  }
}
¡¡¡¡Õâ¶Î´úÂëºÜ¼òµ¥£¬²»ÓýâÊÍÄãÒ²Ó¦¸ÃÄÜ¿´Ã÷°×¡£ÔÚ¹¹Ô캯ÊýÖÐÄã¿´µ½ÓÃthis.print(),ÄãÍêÈ«¿ÉÒÔÓÃprint()À´´úÌæËü£¬Á½ÕßЧ¹ûÒ»Ñù¡£ÏÂÃæÎÒÃÇÐÞ¸ÄÕâ¸ö³ÌÐò£¬À´ÑÝʾsuperµÄÓ÷¨¡£
class Person{
  public int c;
  private String name;
  private int age;
  protected void setName(String name){
    this.name=nam


Ïà¹ØÎĵµ£º

java ¼¯ºÏ

< type="text/javascript"> document.body.oncopy = function() { if (window.clipboardData) { setTimeout(function() { var text = clipboardData.getData("text"); if (text && text.length>300) { text = text + "\r\n\n±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£º" + location.href; clipboardData.setData( ......

Java¸ß¼¶ÌØÐÔ 2

6.·ºÐÍ:
1¡¢·ºÐ͵ÄÀàÐͲÎÊýÖ»ÄÜÊÇÀàÀàÐÍ£¨°üÀ¨×Ô¶¨ÒåÀࣩ£¬²»ÄÜÊǼòµ¥ÀàÐÍ¡£
¡¡¡¡2¡¢Í¬Ò»ÖÖ·ºÐÍ¿ÉÒÔ¶ÔÓ¦¶à¸ö°æ±¾£¨ÒòΪ²ÎÊýÀàÐÍÊDz»È·¶¨µÄ£©£¬²»Í¬°æ±¾µÄ·ºÐÍÀàʵÀýÊDz»¼æÈݵġ£
¡¡¡¡3¡¢·ºÐ͵ÄÀàÐͲÎÊý¿ÉÒÔÓжà¸ö¡£
¡¡¡¡4¡¢·ºÐ͵IJÎÊýÀàÐÍ¿ÉÒÔʹÓÃextendsÓï¾ä£¬ÀýÈç<T extends superclass>¡£Ï°¹ßÉϳÉΪ“Óн ......

java»·¾³ÉèÖÃ

°²×°ºÃjdkÒÔºóÐèÒªÌí¼Ó»·¾³±äÁ¿,²ÅÄÜÔÚÃüÁîÐÐÖÐʹÓÃjavaÃüÁî.
ºÜ¶àÈË"ÎÊΪʲôjavacÕÒ²»µ½"¾ÍÊÇÒòΪûÌí¼Ó»·¾³±äÁ¿.
windows ÉÏ¿Éдһ¸ö.bat½Å±¾:
set JAVA_HOME=d:\Java\jdk1.6.0_20
set PATH=%PATH%;%JAVA_HOME%\bin ......

JavaÖÐÔõô¸Ä±ä×ÖÌåµÄÒ»¸ö¼òµ¥ÊµÀýºÍÔËÐÐЧ¹û

package java;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.*;
public class fontnameDome extends JFrame implements ActionListen ......

javaÎļþ²Ù×÷


package com.gamvan.tools;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.Inpu ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ