»Ø¹ËJava±à³Ì˼Ïëƪ£¨¶þ£©
4¡¢Ïú»Ù¶ÔÏó JavaÖв»ÐèÒª³ÌÐòÔ±×Ô¼ºÈ¥Ïú»Ù¶ÔÏó£¬ÕâÊÇΪʲôÄØ£¿ ÔÚC++ÖУ¬¶ÔÓÚ±äÁ¿¼°¶ÔÏóÉúÃüÖÜÆÚµÄά»¤Õ¼¾ÝÁË´óÁ¿µÄ±à³Ìʱ¼ä£¬ÒòΪ³ÌÐòÔ±ÐèÒªÖªµÀ±äÁ¿´æ»îµÄʱ¼ä£¬ÒÔ±ãÔÚÓÃÍêÖ®ºóÄÜ°ÑËüÏú»Ù£¬²»È»»áÕ¼ÂúÄÚ´æ¿Õ¼ä£¬×èÈû³ÌÐò¡£Òò´ËJavaÔÚÉè¼Æʱ¶Å¾øÁËÕâÒ»ÎÊÌâ¡£ÄÇôJavaÊÇÔõô×öµÄÄØ£¬¿´ÏÂÃæµÄ½éÉÜ¡£ 4.1¡¢±äÁ¿×÷ÓÃÓò ×÷ÓÃÓò¾ö¶¨Á˶¨ÒåÔÚÆäÄڵıäÁ¿ÃûµÄ¿É¼ûÐÔºÍÉúÃüÖÜÆÚ¡£ÔÚJavaÖÐ×÷ÓÃÓòÓÉ»¨À¨ºÅµÄλÖþö¶¨¡£ÎÒÃÇÏÈ¿´Ò»Ï±äÁ¿µÄ×÷ÓÃÓò£¬ÀýÈ磺package com.fei.test;
public class TestJava {
public static void main(String[] args) {
int x = 10;
//½öx±äÁ¿¿ÉÓÃ
{
int y =20;
System.out.println("x = " + x);
x = 12;
System.out.println("y = " + y);
//xÓëy¶¼¿ÉÓÃ
}
System.out.println("x = " + x);
//x¿ÉÓã¬y³¬³öÁË×÷ÓÃÓò·¶Î§
}
}
´òÓ¡³öµÄ½á¹ûÊÇ£º
x = 10
x = 12
ÕâÀï·ÖΪÁ½¸ö×÷ÓÃÓò£¬x¶¨ÒåÔÚÒ»¼¶×÷ÓÃÓòÀy¶¨ÒåÔÚ¶þ¼¶×÷ÓÃÓòÀï¡£´Ó½á¹û¿ÉÒÔ¿´³ö¶þ¼¶×÷ÓÃÓòÖжÔx±äÁ¿ÖØи³Öµºó£¬»á¸²¸ÇÉÏÒ»¼¶×÷ÓÃÓòµÄx±äÁ¿µÄÖµ¡£
JavaÖУ¬ÔÚÁ½¸ö×÷ÓÃÓòµÄ±äÁ¿Ãû³ÆÊDz»ÄÜÒ»ÑùµÄ£¬±ÈÈ磺 int x = 10;
{
int y =20;
int x = 12;//±àÒëÆ÷»áÌáʾ´íÎó
}
ÒòΪJavaÉè¼ÆÕßÈÏΪÕâÑù×ö»áµ¼Ö³ÌÐò»ìÂÒ£¬¶øÔÚC++ÖÐÕâÑùÊǺϷ¨µÄ¡£ÀýÈ磺#include "stdafx.h"
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int x = 10;
{
int x = 12;
cout
Ïà¹ØÎĵµ£º
/**
* Ö±½Ó²åÈëÅÅÐò,Ê×ÏȱȽÏa[n]Óëa[n-1]£¬ÔڱȽÏa[n]Óëa[n-2]
* */
public void sort0(double[] a){
for(int i = 0; i < a.length -1; i ++){
......
Class.forName(xxx.xx.xx) ·µ»ØµÄÊÇÒ»¸öÀà
Ê×ÏÈÄãÒªÃ÷°×ÔÚjavaÀïÃæÈκÎclass¶¼Òª×°ÔØÔÚÐéÄâ»úÉϲÅÄÜÔËÐС£Õâ¾ä»°¾ÍÊÇ×°ÔØÀàÓõÄ(ºÍnew ²»Ò»Ñù£¬Òª·ÖÇå³þ)¡£
ÖÁÓÚʲôʱºòÓã¬Äã¿ÉÒÔ¿¼ÂÇÒ»ÏÂÕâ¸öÎÊÌ⣬¸øÄãÒ»¸ö×Ö·û´®±äÁ¿£¬Ëü´ú±íÒ»¸öÀàµÄ°üÃûºÍÀàÃû£¬ÄãÔõôʵÀý»¯Ëü£¿Ö»ÓÐÄãÌáµ½µÄÕâ¸ö·½·¨ÁË£¬²»¹ýÒªÔÙ¼ÓÒ»µã¡£
A a = ......
¹ØÓÚJavaÒç³ö·ÖÀ࣬ÎÒ¾³£Åöµ½µÄÊÇÁ½ÀࣺһÀàÊÇjava.lang.OutOfMemoryError: Java heap space£¬Ò»ÀàÊÇjava.lang.OutOfMemoryError: PermGen space¡£
ÔÚÕâÁ½ÀàÖУ¬Ç°ÕßÅö¼ûµÄ´ÎÊý±È½ÏƵ·±¡£ÒòΪµ¼ÖÂJava heap spaceµÄÇé¿ö£¬ÓÐʱºò²¢²»ÊÇÄÚ´æ²»¹»£¬ËüÒ²»áÅ×´Ë´íÎóÐÅÏ¢¡£ÀýÈçÎÒ¾ÍÅöµ½¹ýÕâÑùµÄÇé¿ö£¬ÎÒµ±Ê±Í¨¹ýGCÈÕÖ¾·¢ÏÖ£¬ÄÚ´ ......
Ò»¸öJava´°¿Ú´ø°´¼ü¼ì²â£¨ÅÜJava¿ÉÊÓС³ÌÐòʱÓã©£¬沒¼ÓÐÞÊΣ¬°³×Ô¼ºÓõΡ£
package math;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/**
* »ù±¾µÄ»æͼ´°¿Ú£¬»Ø³µ¹Ø±Õ´°¿Ú
*/
@SuppressWarnings("s ......