ÓÉJAVA²ÎÊý´«µÝÒý·¢µÄ¶ÔÒýÓõÄ˼¿¼
½ñÌìÔÚ±àдһ¸ö¿ìËÙÅÅÐòº¯Êý£¬ÆäÖÐÏëÓÃÒ»¸öÔÚC++ÖÐÀàËÆswap¹¦Äܵĺ¯Êý£¬½á¹ûÒý·¢ÁËһϵÁеÄÎÊÌâ¡£
ÏÂÃæÊÇÔÚÍøÉÏËѵ½µÄ´úÂ룬²¢ÔÚÎҵı¾µØ»úÉÏ×÷ÁËÔËÐС£
public class ParamTest
{
public static void main(String[] args)
{
/*
*Test 1:Methods can't modify numeric parameters
*/
System.out.println("Testing tripleValue:");
double percent = 10;
System.out.println("Before: percent =" + percent);
tripleValue(percent);
System.out.println("After: percent = " + percent);
/*
*Test 2: Methods can change the state of object
* parameters
*/
System.out.println("\nTesting tripleSalary:");
Employee harry = new Employee("Harry",50000);
System.out.println("Before: salary =" + harry.getSalary());
tripleSalary(harry);
System.out.println("After: salary =" + harry.getSalary());
/*
*Test 3: Methods can't attach new objects to
* object parameters
*/
System.out.println("\nTesting swap:");
Employee a = new Employee("Alice",70000);
Employee b = new Employee("Bob",60000);
System.out.println("Before: a &nb
Ïà¹ØÎĵµ£º
×÷ΪһÃû³ÌÐòÔ±£¬×ÜÒª¾Àú´ÓС¹æÄ£µÄ¾Ö²¿±àÂëת»»µ½´óÐÍÈí¼þÉè¼Æ¡¢¿ª·¢µÄ¹ý³Ì¡£Ôڴ˹ý³ÌÖУ¬ÔÚÊìϤÁ˱à³ÌÓïÑÔºó£¬ÐèÒª½«ÑÛ¹âÉÏÉýÒ»¸ö²ãÃæ£¬´ÓÕûÌåÈ¥°ÑÎÕÕû¸öÈí¼þµÄ¼Ü¹¹£¬Õë¶ÔÒ»¸öÐÐÒµµÄ¾ßÌåÒµÎñ£¬Äܹ»Éè¼ÆÒ»¸öºÏÀíµÄ¼Ü¹¹£¬Ìá¸ßÈí¼þµÄ¿É¿¿ÐÔ¡¢¿Éά»¤ÐÔ¡¢¿É¸´ÓÃÐÔ¡£¾ÍÏñһλ¾Ñé·á¸»µÄͬÊÂËùË ......
ÏÈÀ´Á˽âÒ»ÏÂÁ´±íģʽµÄÔÀí£º
Ê×ÏÈдһ¸öJavaBean£¬ÄÚÈÝÊÇÒªÌí¼ÓµÄÔªËØºÍ¸ÃÔªËØµÄ½Úµã¡£
public class NodeBean implements Serializable
{
private Object data; //ÔªËØ±¾Éí
private NodeBean next; //ÏÂÒ»¸ö½Úµã
&n ......
/////////////////////DogTestDrive/////////////////////
class DogTestDrive {
public static void main(String[] args) {
Dog one = new Dog();
one.size = 70;
Dog two = new Dog();
two.size = 8;
......
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class LRU {
int blockCount;
int seriaCount;
int[] address;
int[] stack;
BufferedReader br;
public static void main(String[] args) {
// int address[] = { 1, 2,3, 2, 8, 4, 3 ......