javaºÍC++µÄÓï·¨Çø±ð—1
C++ÓëJavaµÄÓï·¨Çø±ð
Ê×ÏÈ£¬Á½¸ö´óµÄ²»Í¬ÊÇÖ÷º¯ÊýºÍÔõÑù±àÒëµÄ²»Í¬£¬½ÓÏÂÀ´ÊÇÐí¶àСµÄÇø±ð¡£
main º¯Êý
C++
//×ÔÓɸ¡¶¯µÄº¯Êý
int main( int argc, char* argv[])
{
printf( "Hello, world" );
}
Java
// ÿ¸öº¯Êý¶¼±ØÐëÊÇÒ»¸öÀàµÄÒ»²¿·Ö;µ±java <class>ÔËÐÐÊÇÒ»¸öÌØ¶¨ÀàµÄÖ÷º¯Êý»á±»µ÷ÓÃ
// (Òò´ËÄã¿ÉÒÔÈÃÿ¸öÀà¶¼ÓÐÒ»¸ömainº¯Êý£¬ÕâÔÚдµ¥Ôª²âÊÔÊǺÜÓÐÓÃ)
class HelloWorld
{
public static void main(String args[])
{
System.out.println( "Hello, World" );
}
}
ÀàµÄÉùÃ÷
³ýÁË Java ²»ÒªÇóÓ÷ֺÅÍ⼸ºõÊÇÏàͬµÄ¡£
C++
class Bar {};
Java
class Bar {}
·½·¨ÉùÃ÷
¶¼ÏàͬµÄ, ³ýÁËÔÚJava,·½·¨±ØÐë×ÜÊÇij¸öÀàµÄÒ»²¿·Ö²¢ÇÒ¿ÉÄÜpublic/private/protected ×÷ΪÐÞÊÎ
¹¹Ô캯ÊýºÍÎö¹¹º¯Êý
¹¹Ô캯Êý¶¼ÊÇÏàͬµÄ (¼´ÀàµÄÃû×Ö), JavaûÓÐ׼ȷÒâÒåÉϵĵÄÎö¹¹º¯Êý
¾²Ì¬³ÉÔ±º¯ÊýºÍ±äÁ¿
·½·¨ÉùÃ÷ÊÇÏàͬµÄ, µ« Java Ìṩ¾²Ì¬³õʼ»¯¿éÀ´À´³õʼ»¯¾²Ì¬±äÁ¿ (²»ÐèÒªÔÚÔ´ÎļþÖÐÉùÃ÷):
class Foo
{
static private int x;
// ¾²Ì¬³õʼ»¯¿é
{ x = 5; }
}
¶ÔÏóµÄÉùÃ÷
C++
// ÔÚÕ»ÖÐ
myClass x;
//»òÕßÔÚ¶ÑÖÐ
myClass *x = new myClass;
Java
// ×ÜÊÇÔÚ¶Ô¶ÑÖÐÉùÃ÷
myClass x = new myClass();
¼Ì ³Ð
C++
class Foo : public Bar
{ ... };
Java
class Foo extends Bar
{ ... }
·ÃÎʼ¶±ð (abstraction barriers)
C++
public:
void foo();
void bar();
Java
public void foo();
public void bar();
Ð麯Êý
C++
 
Ïà¹ØÎĵµ£º
jdkÌṩÁËZipÏà¹ØµÄÀà·½±ãµÄʵÏÖѹËõºÍ½âѹËõ¡£Ê¹Ó÷½·¨ºÜ¼òµ¥¡£Ï±߷ֱðÊÇѹËõºÍ½âѹËõµÄ¼òµ¥ÊÂÀý
1¡¢Ñ¹ËõµÄ
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipE ......
5.ÈçºÎ´ÓJVMÖлñÈ¡ÐÅÏ¢À´½øÐе÷Õû
¡¡¡¡-verbose.gc¿ª¹Ø¿ÉÏÔʾgcµÄ²Ù×÷ÄÚÈÝ¡£´ò¿ªËü£¬¿ÉÒÔÏÔʾ×îæºÍ×î¿ÕÏÐÊÕ¼¯ÐÐΪ·¢ÉúµÄʱ¼ä¡¢ÊÕ¼¯Ç°ºóµÄÄÚ´æ´óС¡¢ÊÕ¼¯ÐèÒªµÄʱ¼äµÈ¡£´ò¿ª- xx:+ printgcdetails¿ª¹Ø£¬¿ÉÒÔÏêϸÁ˽âgcÖеı仯¡£´ò¿ª-XX: + PrintGCTimeStamps¿ª¹Ø£¬¿ÉÒÔÁ˽âÕâЩÀ¬»øÊÕ¼¯·¢ÉúµÄʱ¼ä£¬×ÔjvmÆô¶¯ÒÔºóÒÔ ......
Ò»¸öʹÓÃÁ˶ÓÁеÄͨÓÃʵÏÖ£º
http://blog.csdn.net/chaosllgao/archive/2009/05/23/4211183.aspx
´ËÎÄÃèÊöÁËÒ»ÖÖ¸ü¼òµ¥µÄÄ£ÐÍ
1. ͬʱֻÓÐ1¸öÉú²úÕߺÍ1¸öÏû·ÑÕß
2. ²»ÓöÓÁУ¬Í¬Ê±Ö»ÓÐÒ»¸ö²úÆ·
3. Éú²úÕßÿ´ÎÉú²ú1¸ö0µ½100Ö®¼äµÄËæ»úÊý£¬Ïû·ÑÕßÔò°Ñ¸ÃËæ»úÊý´òÓ¡³öÀ´¡£Èç¹û²úÉúµÄËæ»úÊýΪ0£¬Ôò ......
±¾ÎÄ·ÖÁ½²¿·Ö£ºFLASH±à³Ì ºÍ Java±à³Ì£¬´ËÎļǼµÄ½ö½öÊÇÎÒÔÚ̽Ë÷ÖеÄһЩÊÕ»ñ£¬ÆäÖÐÓÃÁ˺ܶà¸öÈË»¯µÄÃèÊöÓïÑÔ£¬²¢²»ÊÇÒµ½ç±ê×¼µÄÓÃÓï¡£ £º£©
̽Ë÷±Ê¼Ç£º
Ŀǰ¹úÄÚFlashÓ¦Óô󲿷ֻ¹ÊÇÔÚÖÆ×÷¾«ÃÀµÄ¶¯»·½Ã棬µ«¾ÝÎÒÁ˽âÔçÔÚFlash4 µÄʱ´ú£¬¹úÍâһЩÈ˾ÍÒѾ¿ªÊ¼½«flash¼¼ÊõÔËÓÃÓÚ¿ª·¢¶¯Ì¬ÍøÕ¾£¨ºÍphp¡ ......
finalize·½·¨
ËüÊÇjava.lang.ObjectÀàÖеķ½·¨. ÊÇprotectedµÄ.
ȱʡʱÕâ¸ö·½·¨ÊǿյÄ. JavaÔËÐÐϵͳÔÚÀ¬»ø»ØÊÕʱÔÚ¶ÔÏó±»³·Ïú֮ǰµ÷ÓÃÕâ¸ö·½·¨. µ«ÓÉÓÚÀ¬»øµ¥Ôª
»ØÊÕµÄʱ¼äÊDz»È·¶¨µÄ.ËùÒÔ²»Äܹý·ÖÒÀÀµËü(ÕâºÍc++µÄÎö¹¹º¯Êý²»Í¬).
¶øÖ»ÄÜÊÇ"ÔÚ¶ÔÏó±»³·Ïú֮ǰ"×öһЩ´¦Àí.ÀýÈç¿ÉÒÔÔÚÕâÀï¹Ø±Õ¹¹Ôì·½·¨Öдò¿ ......