java×Ü½á µÚÁùÕÂ
µÚÁùÕÂ
javaÀàÉè¼Æ
extendsÀàµÄ¼Ì³Ð
objectÀàÊÇËùÓÐjavaÀàµÄ×î¸ß²ã¸¸Àà
javaÖ»Ö§³Öµ¥¼Ì³Ð ²»ÔÊÐí¶àÖؼ̳Ð
Ò»¸ö×ÓÀàÖ»ÓÐÒ»¸ö¸¸Àà Ò»¸ö¸¸Àà¿ÉÓÃÓжà¸ö×ÓÀà
public default protected public
·½·¨ÖØд
ÔÚ×ÓÀà¿ÉÓøù¾ÝÐèÒª¶Ô¸¸Àà¼Ì³ÐµÄ·½·¨½øÐиÄÔì--·½·¨µÄÖØд
ÖØд·½·¨±ØÐëºÍ±»ÖØд·½·¨¾ßÓÐÏàͬµÄ·½·¨Ãû³Æ ²ÎÊýÁÐ±í ·µ»ØÖµÀàÐÍ ÖØд·½·¨²»ÄÜʹÓñȱ»ÖØд·½·¨¸üÑϸñµÄ·ÃÎÊȨÏÞ ÖØд·½·¨²»ÄÜÒýÆð±È¸¸Àà¸ü¶àµÄÒì³£
·½·¨ÉùÃ÷±ØÐëÔÚÖ÷º¯ÊýÍâ
javaʹÓÃsuperÀ´ÒýÓø¸ÀàµÄ³É·Ö
¿É·ÃÎʸ¸ÀàµÄÊôÐÔ ³ÉÔ±·½·¨ ¸¸ÀàµÄ¹¹Ôì·½·¨ ×·Ëݵ½Ö±½Ó¸¸Àà
this±¾Àà super¸¸Àà
¶à̬
ÔÚjavaÖÐ ×ÓÀàµÄ¶ÔÏó¿ÉÒÔÌæ´ú¸¸ÀàµÄ¶ÔÏóʹÓÃ
Ò»¸ö¶ÔÏóÖ»ÄÜÓÐÒ»ÖÖÈ·¶¨µÄÊý¾ÝÀàÐÍ
person p=new student();
object o=new person();
o=new student();
Ç°Ã游Àà ºóÃæ×ÓÀà
¶à̬ÐÔ
Ò»¸öÒýÓÃÀàÐͱäÁ¿Èç¹ûÉùÃ÷Ϊ¸¸ÀàµÄÀàÐÍ µ«Êµ¼ÊÒýÓõÄÊÇ×ÓÀà¶ÔÏó ÄÇô¸Ã±äÁ¿¾Í²»ÄÜÔÙ·ÃÎÊ×ÓÀàÖÐÐÂÌí¼ÓµÄÊôÐԺͷ½·¨
Ðé·½·¨µ÷ÓÃ
person a=new student();
a.getInfo();
instanceof²Ù×÷·û
public class person extends object{};
public class student extends person{};
public class graduate extends person{};
public void method(person e) //ʵÀý»¯µÄe
{
if(e instanceof student)
{
}
else if(e instanceof garduate)
{
}
else {
//´¦ÀípersonÀà¶ÔÏó
}
}
¶Ôjava¶ÔÏóµÄÇ¿ÖÆÀàÐÍת»»³ÆΪÔìÐÍ
´Ó×ÓÀൽ¸¸ÀàµÄÀàÐÍת»»¿ÉÒÔ×Ô¶¯½øÐÐ
´Ó¸¸Àൽ×ÓÀàµÄÀàÐÍת»»±ØÐëͨ¹ýÔìÐÍ(Ç¿ÖÆÀàÐÍת»»)ʵÏÖ
Î޼̳йØϵµÄÒýÓÃÀàÐͼäת»»Ê±·Ç·¨µÄ
public class Test{//Person¼°StudentÀàµÄ¶¨ÒåÒÑÓÐ
public void method(Person e) { //ʵÀý»¯µÄe
System.out.pritnln(e.getschool()); //·Ç·¨ ²»ÄÜÓÃstudentµÄ±äÁ¿
if(e intstanceof Student){
Student me = (Student)e;//°ÑpersonÀàµÄeÇ¿ÖÆת»»ÎªstudentÀà
System.out.pritnln(me.getschool());//ÕâÑù¿ÉÒÔµ÷ÓÃÁË
}
}
·½·¨ÃûÖØÔØ
ÔÚÒ»¸öÀàÖпÉÒÔ¶¨Òå¶à¸öͬÃû·½·¨--·½·¨ÃûÖØÔØ
ÖØÔØ·½·¨µÄ²ÎÊýÁбí±ØÐ벻ͬ
ÖØÔØ·½·¨µÄ·µ»ØÖµÀàÐÍ¿ÉÒÔÏàͬ Ò²¿ÉÒÔ²»Í¬
public void printl(int i){};
public void printl(float i){};
public int printl(int i){};
¹¹Ôì·½·¨ÖØÔصIJÎÊýÁбí±ØÐ벻ͬ
¿ÉÒÔÔÙ¹¹Ôì·½·¨µÄµÚÒ»ÐÐʹÓÃthis¹Ø¼ü×Öµ÷ÓÃÆäËûÖØÔصĹ¹Ôì·½·¨
public class person
{
public person(int a){};
public person(int a ,int
Ïà¹ØÎĵµ£º
ÔÚÕâ¸öÒ³ÃæÉÏhttp://rymden.nu/exceptions.html£¬Äã»á¿´µ½JavaµÄ¸÷ÖÖÒì³££¬²»¹ý£¬Äã¿´¿´¸÷¸öÒì³£µÄ½âÊÍ£¬Äã»á·¢Ïַdz£ÓÐȤ£¬ÏÂÃæÀý¾Ù¼¸¸ö°É£º
java.lang.ArithmeticException
ÄãÕýÔÚʹÓüÆËã½â¾öÒ»¸öÄã²»ÄÜ×Ô¼º½âÊ͵ÄÊýѧÎÊÌ⣬ÇëÄãÖØжÁÒ»ÏÂÄãµÄ³ÌÐò£¬È»ºó£¬ÔÙÊÔÒ»´Î¡£
java.lang.ClassNotFoundException
ÄãÓ¦¸ÃÊÇ·¢Ã ......
JavaÓëTSCÌõÐÎÂë´òÓ¡»ú(Ðø)
ÓÖ³öÏÖÁ½¸öÎÊÌâ:
1,sendcommandÃüÁîʹÓò¿·Ö³É¹¦£¬¿ÉÒÔÉèÖÃdirection 1,1ʹ´òÓ¡Ò³ÍêÈ«¾µÃ棬µ«ÊÇÈ´²»ÄÜʹÓÃcircle´òÓ¡³öԲȦȦ¡£
2£¬ÓÖÒ»´ÎÔÔµ½ÁËlinux-windowsÊÖÀÔÚwindows¿ª·¢Íê³Éºó£¬linux²»ÄÜʶ±ðtsclib.dll¡£ÔΣ¡
3£¬
×öjava-tsc´òÓ¡ÌõÐÎÂëÓöµ½Á˺ܶàÀ§ÄÑ£¬ÍøÉÏ×ÊÁϲ»Ò ......
Ö÷ÒªÊÇÀûÓÃJavaÌṩµÄutil°üÖеÄPropertiesÀà¡£·Ï»°²»¶à˵£¬Ö±½Ó¿´´úÂ룺
view plaincopy to clipboardprint?
import java.util.*;
public class YourJavaProperties {
public static void main(String args[]){
Properties props=System.getProperties();
System.out.println("JavaµÄÔËÐл·¾³°æ±¾£º"+props.getP ......
¹éÄÉһЩÍøÉÏÈ¡JAVA·¾¶µÄ·½·¨£º
×¢Ã÷£ºÈç¹û´ÓANTÆô¶¯³ÌÐò£¬this.getClass().getResource("")È¡³öÀ´µÄ±È½Ï¹Ö£¬Ö±½ÓÓÃJAVAÃüÁîÐе÷ÊԾͿɳɹ¦¡£
µÃµ½classpathºÍµ±Ç°ÀàµÄ¾ø¶Ô·¾¶µÄһЩ·½·¨
»ñµÃCLASSPATHÖ®Íâ·¾¶µÄ·½·¨£º
URL
base = this.get ......
//JavaµÄIOµÄÒ»¸öʵÀý
import java.io.*;
import java.util.zip.*;
public class abc5{
String temp=new String();
String t=new String();
public void readByLinefromConsoleAndPrint(){
System.out.println("==´Ó¿ØÖÆ̨»ñµÃÊäÈë==");
try{
BufferedReader in=new ......