Ò»¸öJAVAÎÊÌâ×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes
ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape:
package Shapes;
public class BasicShape{
...
}
È»ºóÔÚͬÑùµÄdirectory Ï£¬ дÁ˸ö½ÐShape2DµÄclass¼Ì³ÐBasicShape:
package BasicShape;
public class Shape2D extends BasicShape{
...
}
µ«µ±ÎÒcompile Shape2D.javaµÄʱºò£¬ ˵ÕÒ²»µ½class BasicShape,
²»ÖªµÀÊÇʲôÔÒò£¬ лл½â´ð[²»¶Ô°¡ (6-20 14:29, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]1Â¥
¿´À´ÊÇengineµÄpackage Shapes;
public class BasicShape{
...
}
package BasicShape;
public class Shape2D extends BasicShape{
...
}
Äã°ÑBasicShape·Åµ½ÁËShapes packageÀïÃæ, ÓÖ°ÑShape2D·Åµ½ÁË BasicShape packageÀïÃæ.
ÕâÑùShape2D¸ù±¾¿´²»µ½BasicShapeµÄ´æÔÚ...
Äã°Ñpackage BasicShape»»³É package Shapes »òÕ߸ɴà2¸öpackage¶¼²»ÒªÁË, ¾ÍûÎÊÌâÁË[Ñó´ÐÍ· (6-20 18:17, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]2Â¥
²»ºÃÒâ˼£¬ ÎÊÌâÎÊ´íÁË¡£¡£×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes
ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape:
package Shapes;
public class BasicShape{
...
}
È»ºóÔÚͬÑùµÄdirectory Ï£¬ дÁ˸ö½ÐShape2DµÄclass¼Ì³ÐBasicShape:
package Shapes; // ÔÀ´µÄpostÀïд³Épackage BasicShapeÁË£¬ ±ÊÎó
public class Shape2D extends BasicShape{
...
}
µ«µ±ÎÒcompile Shape2D.javaµÄʱºò£¬ ˵ÕÒ²»µ½class BasicShape,
²»ÖªµÀÊÇʲôÔÒò£¬ лл½â´ð[²»¶Ô°¡ (6-21 10:18, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]3Â¥
(ÒýÓà ²»¶Ô°¡:²»ºÃÒâ˼£¬ ÎÊÌâÎÊ´íÁË¡£¡£×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape: package Shapes;...)¸úÏÂÃæÑó´ÐÍ·µÄ[²»¶Ô°¡ (6-21 10:18, Long long ago)] [ ´«Í³°æ | sForum ][µÇ¼ºó»Ø¸´]4Â¥
(ÒýÓà ²»¶Ô°¡:²»ºÃÒâ˼£¬ ÎÊÌâÎÊ´íÁË¡£¡£×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape: package Shapes;...)jdk1.5.2_07[²»¶Ô°¡ (6-21 10:21, Long long ago)] [ ´«Í³°æ | sForum ][µÇ¼ºó»Ø¸´]5Â¥
(ÒýÓà ²»¶Ô°¡:²»ºÃÒâ˼£¬ ÎÊÌâÎÊ´íÁË¡£¡£×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes
ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape:
package Shapes;...)--->codeÕâÑùдÊÇûÎÊÌâµÄ. ¶øÇÒÎÒÒ²ÓÃJcreator complieÁË, ûÓÐÎÊÌâ.
ÄãµÄÎÊÌâ¿ÉÄܳöÔÚÄãûÓÐÏÈcompile BasicShape.java¾ÍÖ±½Ócomplie Shape2D.java ÕâÑùµÄ»°Ò²»áÕÒ²»µ½BasicShape class
µ±ÄãcompileÁËBasicShape.javaÒÔºó, ÔÚÕâ¸ödirectoryÏÂÃæÓ¦¸ÃÓÖ¶à³öÒ»¸öÃû×ÖΪShapesµÄfolder, ¾ÍÊÇÄãµÄÄǸöpackage Shapes
folderÀïÃæ»áÓÐBasicShape.class. Õâ¸öʱºòÄãÔÙcompile Shape2D.javaÓ¦¸Ã¾ÍºÃÁË[Ñó´ÐÍ· (6-21 14:53, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]6Â¥
(ÒýÓà ²»¶Ô°¡:²»ºÃÒâ˼£¬ ÎÊÌâÎÊ´íÁË¡£¡£×¼±¸½¨Á¢Ò»¸öpackage ½Ð×÷ Shapes
ÔÚÕâ¸ö packageÀïÃ棬 ÏÈдÁ˸ösuper class½ÐBasicShape:
package Shapes;...)Ó¦¸ÃÊÇĿ¼µÄÎÊÌâÓ¦¸Ã°ÑÁ½¸ö.javaÎļþ¶¼·ÅÔÚShapesµÄĿ¼Àï¡£packageµÄ½á¹¹Ó¦¸ÃºÍÎļþĿ¼½á¹¹Ò»Ñù¡£javacºÍjava¶¼Ó¦¸ÃÔÚ×îÉÏÒ»¼¶Ä¿Â¼ÀïÖ´ÐУ¬¼´ShapesµÄÉÏÒ»¼¶Ä¿Â¼¡£ÕýÈ·µÄ½á¹¹Ó¦¸ÃÊÇÕâÑùµÄ:
C:\home>dir
Volume in drive C has no label.
Volume Serial Number is 43C1-842F
Directory of C:\home
06/23/2006 12:06 AM <DIR> .
06/23/2006 12:06 AM <DIR> ..
06/23/2006 12:06 AM <DIR> Shapes
0 File(s) 0 bytes
3 Dir(s) 32,119,504,896 bytes free
C:\home>dir Shapes
Volume in drive C has no label.
Volume Serial Number is 43C1-842F
Directory of C:\home\Shapes
06/23/2006 12:06 AM <DIR> .
06/23/2006 12:06 AM <DIR> ..
06/23/2006 12:08 AM 0 BasicShape.java
06/23/2006 12:08 AM 0 Shape2D.java
2 File(s) 0 bytes
2 Dir(s) 32,119,504,896 bytes free
C:\home>javac Shapes\Shape2D.java
......
C:\home>java Shapes.Shape2D
......
µ±Äã±àÒëShapes\Shape2D.javaʱ£¬javac»áÈ¥ÕÒShapes\Shape2D.class£¬ÕÒ²»µ½µÄ»°¾Í»á×Ô¶¯È¥ÕÒShapes\Shape2D.javaÀ´²úÉúShapes\Shape2D.class¡£ÄãÓöµ½µÄÎÊÌâ¾ÍÊÇjavacÎÞ·¨ÕÒµ½Shapes\Shape2D.java£¬ÒòΪÄãûÓаÑShape2D.java·ÅÔÚShapes\Àï¡£[ÎâÓÀï£ (6-23 0:12, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]7Â¥
(ÒýÓà ÎâÓÀï£:Ó¦¸ÃÊÇĿ¼µÄÎÊÌâÓ¦¸Ã°ÑÁ½¸ö.javaÎļþ¶¼·ÅÔÚShapesµÄĿ¼Àï¡£packageµÄ½á¹¹Ó¦¸ÃºÍÎļþĿ¼½á¹¹Ò»Ñù¡£javacºÍjava¶¼Ó¦¸ÃÔÚ×îÉÏÒ»¼¶Ä¿Â¼ÀïÖ...)À÷º¦£¬ лл»Ø´ðÎÒÔÀ´µÄCLASSPATHÉèÖÃ³É .
ÔÚͬһ¸öpackageϱàÒë¾ÍÕÒ²»µ½file£¬ ºóÀ´ÎÒ°ÑCLASSPATH¸Ä³É .;.. ¾ÍÐÐÁË
²»¹ýÕâÖÖ·½·¨²»ÈçÄãµÄ·½·¨Í¨Ó㬱ÈÈç¶à²ãpackage[²»¶Ô°¡ (6-24 0:15, Long long ago)]
[ ´«Í³°æ |
sForum ][µÇ¼ºó»Ø¸´]8Â¥
(ÒýÓà Ñó´ÐÍ·:--->codeÕâÑùдÊÇûÎÊÌâµÄ. ¶øÇÒÎÒÒ²ÓÃJcreator complieÁË, ûÓÐÎÊÌâ. ÄãµÄÎÊÌâ¿ÉÄܳöÔÚÄãûÓÐÏÈcompile BasicShape.java¾ÍÖ±½Ócomplie ...)лл½â´ð[²»¶Ô°¡ (6-24 0:15, Long long ago)] [ ´«Í³°æ | sForum ][µÇ¼ºó»Ø¸´]9Â¥