JavaÃæÊÔÌâ¼°´ð°¸£¨´úÂëÌâ19µÀ£©
JAVA´úÂë²é´í
1.
abstract class Name {
private String name;
public abstract boolean isStupidName(String name) {}
}
´óÏÀÃÇ£¬ÕâÓкδíÎó?
´ð°¸: ´í¡£abstract method±ØÐëÒԷֺŽá⣬ÇÒ²»´ø»¨À¨ºÅ¡£
2.
public class Something {
void doSomething () {
private String s = "";
int l = s.length();
}
}
ÓдíÂð?
´ð°¸: ´í¡£¾Ö²¿±äÁ¿Ç°²»ÄÜ·ÅÖÃÈκηÃÎÊÐÞÊηû (private£¬public£¬ºÍprotected)¡£final¿ÉÒÔÓÃÀ´ÐÞÊξֲ¿±äÁ¿
(finalÈçͬabstractºÍstrictfp£¬¶¼ÊÇ·Ç·ÃÎÊÐÞÊηû£¬strictfpÖ»ÄÜÐÞÊÎclassºÍmethod¶ø·Çvariable)¡£
3.
abstract class Something {
private abstract String doSomething ();
}
ÕâºÃÏñûʲô´í°É?
´ð°¸: ´í¡£abstractµÄmethods²»ÄÜÒÔprivateÐÞÊΡ£abstractµÄmethods¾ÍÊÇÈÃ×ÓÀàimplement(ʵÏÖ)¾ßÌåϸ½ÚµÄ£¬Ôõô¿ÉÒÔÓÃprivate°Ñabstract
method·âËøÆðÀ´ÄØ? (ͬÀí£¬abstract methodÇ°²»ÄܼÓfinal)¡£
4.
public class Something {
public int addOne(final int x) {
return ++x;
}
}
Õâ¸ö±È½ÏÃ÷ÏÔ¡£
´ð°¸: ´í¡£int x±»ÐÞÊγÉfinal£¬Òâζ×Åx²»ÄÜÔÚaddOne methodÖб»Ð޸ġ£
5.
public class Something {
public static void main(String[] args) {
Other o = new Other();
new Something().addOne(o);
}
public void addOne(final Other o) {
o.i++;
}
}
class Other {
public int i;
}
ºÍÉÏÃæµÄºÜÏàËÆ£¬¶¼ÊǹØÓÚfinalµÄÎÊÌ⣬ÕâÓдíÂð?
´ð°¸: ÕýÈ·¡£ÔÚaddOne methodÖУ¬²ÎÊýo±»ÐÞÊγÉfinal¡£Èç¹ûÔÚaddOne methodÀïÎÒÃÇÐÞ¸ÄÁËoµÄreference
(±ÈÈç: o = new Other();)£¬ÄÇôÈçͬÉÏÀýÕâÌâÒ²ÊÇ´íµÄ¡£µ«ÕâÀïÐ޸ĵÄÊÇoµÄmember vairable
(³ÉÔ±±äÁ¿)£¬¶øoµÄreference²¢Ã»Óиı䡣
6.
class Something {
int i;
public void doSomething() {
&nb
Ïà¹ØÎĵµ£º
package com.softeem.jbs.lesson4;
import java.util.Random;
/**
* ÅÅÐò²âÊÔÀà
*
* ÅÅÐòËã·¨µÄ·ÖÀàÈçÏ£º
* 1.²åÈëÅÅÐò£¨Ö±½Ó²åÈëÅÅÐò¡¢ÕÛ°ë²åÈëÅÅÐò¡¢Ï£¶ûÅÅÐò£©£»
* 2.½»»»ÅÅÐò£¨Ã°ÅÝÅÝÅÅÐò¡¢¿ìËÙÅÅÐò£©£»
* 3.Ñ¡ÔñÅÅÐò£¨Ö±½ÓÑ¡ÔñÅÅÐò¡¢¶ÑÅÅÐò£©£»
* 4.¹é²¢ÅÅÐò£»
* 5.»ùÊýÅÅÐò¡£
*
* ¹ØÓÚÅÅÐ ......
ѧϰJava±Ø¿´ - JAVA´úÂë±àдµÄ30Ìõ½¨Òé
(1) ÀàÃûÊ××ÖĸӦ¸Ã´óд¡£×ֶΡ¢·½·¨ÒÔ¼°¶ÔÏ󣨾ä±ú£©µÄÊ××ÖĸӦСд¡£¶ÔÓÚËùÓбêʶ·û£¬ÆäÖаüº¬µÄËùÓе¥´Ê¶¼Ó¦½ô¿¿ÔÚÒ»Æ𣬶øÇÒ´óдÖм䵥´ÊµÄÊ××Öĸ¡£ÀýÈ磺
ThisIsAClassName
thisIsMethodOrFieldName
ÈôÔÚ¶¨ÒåÖгöÏÖÁ˳£Êý³õʼ»¯ ......
ÎÒ²»ÖªµÀÕâƪÎÄÕµÄ×÷ÕßÊÇË£¬µ«ÎÒÖªµÀ£¬Ëû¶ÔjavaÓÐÒ»ÖÖºÜÉîµÄÀí½â£¬ÆäʵÎÄÕÂÖв¢Ã»ÓÐÌåÏÖ³ö×÷Õ߶Ôjava¼¼ÊõÉî²ãÀí½â£¬µ«ÊÇ´ÓÎÄÖеÄÿһ¾ä»°ÖУ¬ÎÒ¸ÐÊܵ½ÁËһЩ¶«Î÷¡£ÕâÊÇһƪºÜºÃµÄÎÄÕ£¬Ò²¿ÉÒÔ°ïÖúºÜ¶àÈËÃÔãµÄÈ˽â¾öÎÊÌâ¡£´øÀ´ºÍ´ó¼Ò·ÖÏíһϡ£
Ç°²»¾ÃCSDN¿¯µÇÁËһƪ¡¶CÓïÑÔÒѾËÀÁË¡·µÄÎÄÕ£¬ÒýÆðÁËһЩÕùÂÛ¡£ÆäʵÄÇÆ ......
JAVAºÍC++¶¼ÊÇÃæÏò¶ÔÏóÓïÑÔ¡£Ò²¾ÍÊÇ˵£¬ËüÃǶ¼Äܹ»ÊµÏÖÃæÏò¶ÔÏó˼Ï루·â×°£¬¼Ì³Ë£¬¶à̬£©¡£¶øÓÉÓÚc++ΪÁËÕչ˴óÁ¿µÄCÓïÑÔʹÓÃÕߣ¬¶ø¼æÈÝÁËC£¬Ê¹µÃ×ÔÉí½ö½ö³ÉΪÁË´øÀàµÄCÓïÑÔ£¬¶à¶àÉÙÉÙÓ°ÏìÁËÆäÃæÏò¶ÔÏóµÄ³¹µ×ÐÔ£¡JAVAÔòÊÇÍêÈ«µÄÃæÏò¶ÔÏóÓïÑÔ£¬Ëü¾ä·¨¸üÇåÎú£¬¹æÄ£¸üС£¬¸üÒ×ѧ¡£ËüÊÇÔÚ¶Ô¶àÖÖ³ÌÐòÉè¼ÆÓïÑÔ½øÐÐÁËÉîÈëϸÖÂÑо¿µ ......
JavaʼþÄ£ÐÍÓëAndroidʼþÄ£Ð͵ıȽÏ
±È½Ï½á¹û£ºAndroid½è¼øÁËJava2ÖеÄUIʼþ´¦Àí»úÖÆ£¬µ«ÊÇ£¬AndroidÓÖÌṩÁËÁíÒ»ÖÖʼþ處ÀíÆ÷£¨event handler£©£¬¶øÕâ¸ö·½Ê½ÊÇ·ñÓëjava1.0ʼþÄ£ÐÍÒ»ÑùÄØ£¬ÓдýÇóÖ¤¡£
JavaʼþÄ£ÐÍ£º
ÎÒÃÇ°ÑJDK1.0ʼþ´¦ÀíÄ£ÐͳÉΪJava1.0ʼþÄ£ÐÍ£¬¶ø´Ójdk1.1ºóµÄ°æ±¾Ê¼þ´¦ÀíÄ£ÐͳÆΪJava 2Ê ......