JavaÓëC++µÄ¶à̬
ûÓбØÒªÓÃÒ»¶ÑÈÆ¿ÚµÄÐÎÈÝ´ÊÀ´ÃèÊöʲô½Ð¶à̬£¬Ö»¾Ù³ö¼¸¸ö¹Ø¼üµã¡£
É裺gunΪ¸¸À࣬shootgunºÍpistolΪgunµÄ×ÓÀà¡£
Java:
class gun {
void shoot() {
System.out.println("gun shoot");
}
}
class shootgun extends gun {
void shoot() {
System.out.println("shootgun shoot");
}
}
class pistol extends gun {
void shoot() {
System.out.println("pistol shoot");
}
}
C++:
class gun
{
void shoot()
{
cout << "gun shoot" << endl;
}
};
class shootgun : gun
{
void shoot()
{
cout << "shootgun shoot" << endl;
}
};
class pistol : gun
{
void shoot()
{
cout << "pistol shoot" << endl;
&n
Ïà¹ØÎĵµ£º
//=============================Êä³öÆæÊý
public class OddTest {
public static boolean isOdd(int i){
return i % 2 != 0; //±È½Ï i % 2 == 0;×¢£º -1%2 = -1
}
public static void main(String[] args) {
for(int i = -10; i <= 10; i++) {
System.out.println(isOdd(i));
}
}
}
// ......
ÉÏÒ»´Î£¬ÎÒÃÇÍê³ÉÁ˽çÃæµÄ×éÖ¯¡£½ÓÏÂÀ´ÎÒÃÇÍê³ÉÒµÎñÂß¼¡£
1£©ÈçºÎÍê³ÉÖÜΧÏàÁڵİ´Å¥±äÉ«¡£
·ÖÎö£ºÒòΪÎÒÃÇ×öÁËÒ»¸ö5*5µÄÊý×é¡£²¢ÇÒÊÂÏÈÎÒÃǸøÿ¸ö×Ô¶¨ÒåµÄbutton¼ÓÁËxºÍy×ø±ê
¾ÍÊÇΪÁ˸ü·½±ãµÄ¸øÏàÁڵİ´Å¥±äÉ«¡£
µ±ÎÒÃǵã»÷(2£¬2)°´Å¥Ê±£¬ÖÜΧµÄ 4¸ö°´Å¥»á±ä»¯¡£
µ±È»Ê×ÏÈÎÒÃÇÓ¦¸ÃÏȸøÿ¸ö°´Å¥Ôö¼Ó¼àÌýÆ÷¡£Î ......
public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) ......
URI ÊÇ×ÊÔ´±êʶ·û¡£¾ÍÊÇÏ൱ÓÚÒ»¸öÈ˵ļÒͥסַ¡£
URLºÍURIÀàËÆ¡£ÊÇ×ÊÔ´¶¨Î»µÄ¡£ ºÍURI²»Í¬µÄ¾ÍÊÇURLÌṩÁË»ñÈ¡¶«Î÷µÄ·½·¨¡£
java.io.InputStream l_urlStream;
// Ò²¿ÉÒÔ»»³Éuri,È»ºóµ÷ÓÃuri.toURL
  ......
ÔÚÐÅϢʱ´ú£¬ÍøÂç¼¼ÊõÓ¦ÓÃÒѷdz£ÆÕͨ¡£ÆäÖзdz£¶àÓ¦Óö¼ÒÀÀµÓÚ´ÓÒ»¸öÖ÷»úÏò¶à¸öÖ÷»ú»ò´Ó¶à¸öÖ÷»úÏò¶à¸öÖ÷»ú·¢ËÍͬһÐÅÏ¢µÄÄÜÁ¦£¬ÔÚInternetÉÏ·Ö·¢µÄÊýÄ¿¿ÉÄÜ´ïÊýÊ®Íǫ̀£¬ÕâЩ¶¼ÐèÒª¸ü¸ßµÄ´ø¿í£¬²¢ÇÒ´ó´ó³¬³öÁ˵¥²¥µÄÄÜÁ¦¡£Ò»ÖÖÄÜ×î´óÏ޶ȵØÀûÓÃÏÖÓдø¿íµÄÖØÒª¼¼ÊõÊÇIP×é²¥¡£
1£®IP×é²¥¼¼ÊõµÄ¸ÅÄî
IP×é²¥¼¼Êõ£¬ÊÇÒ»ÖÖÔÊ ......