JavaÖеIJÎÊýµ÷ÓÃ
Java³ÌÐòÉè¼ÆÓïÑÔʹÓÃÖµµ÷Óá£Ò²¾ÍÊÇ˵¡£·½·¨µÃµ½µÄÊÇËùÓвÎÊýÖµµÄÒ»¸ö¿½±´£¬ÌرðÊÇ£¬·½·¨²»ÄÜÐ޸Ĵ«µÝ¸øËüµÄÈκβÎÊý±äÁ¿µÄÄÚÈÝ¡£
ÏÂÃæ˵Ã÷ÏÂÕâÖÖÇé¿ö¡£¼Ù¶¨Ò»¸ö·½·¨ÊÔͼ½«Ò»¸ö²ÎÊýÖµÔö¼ÓÖÁ3±¶£º
public static void func(double x){
x=3*x
}
µ÷ÓÃÕâ¸ö·½·¨
double d=10;
func(10);
ÎÞÂÛÔõÑùµ÷ÓÃÕâ¸ö·½·¨£¬Ö´ÐÐÖ®ºó£¬dµÄÖµ»¹ÊÇ10¡£ÏÂÃæÊÇËû¾ßÌåÖ´ÐеĹý³Ì¡£
1)¡¢x±»³õʼ»¯ÎªdÖµµÄÒ»¸ö¿½±´
2)¡¢x*3ºóֵΪ30¡£µ«ÊÇdÖµÈÔΪ10¡£
3)¡¢·½·¨½áÊøÖ®ºó£¬²ÎÊý±äÁ¿x²»ÔÙʹÓá£
·½·¨²ÎÊý¹²ÓÐÁ½ÖÖÀàÐÍ;
1)¡¢»ù±¾µÄÊý¾ÝÀàÐÍ(Êý×Ö¡¢²¼¶ûÐÍ)¡£
2)¡¢¶ÔÏóÒýÓá£
Ò»¸ö·½·¨²»¿ÉÄÜÐÞ¸ÄÒ»¸ö»ù±¾Êý¾ÝÀàÐ͵IJÎÊý£¬¶ø¶ÔÏóÒýÓÃ×÷Ϊ²ÎÊý¾Í²»Í¬ÁË¡£ºÜÈÝÒ×Ð޸ĶÔÏóÀïÃæµÄÊý¾Ý¡£
public static void func(employe x) //employe¶ÔÏóÔÚÏÂÃæ¸ø³ö¡£
{
x.setage(20);
}
µ±µ÷ÓÃ
harry =new employe(……)£»
func(harry);
¶ÔÏóÒýÓõÄÖ´Ðйý³ÌΪ£º
1)¡¢x±»³õʼ»¯ÎªharryÖµµÄÒ»·Ý¿½±´£¬ÕâÀïÊÇÒ»¸ö¶ÔÏóµÄÒýÓá£
2)¡¢setage·½·¨Ó¦ÓÃÓÚÕâ¸ö¶ÔÏóµÄÓ¦Óá£xºÍharryͬʱÒýÓÃÄǸöemploye¶ÔÏóµÄage¡£
3)¡¢·½·¨½áÊøºó£¬²ÎÊý±äÁ¿x²»ÔÙʹÓᣵ±È»£¬¶ÔÏó±äÁ¿harry¼ÌÐøÒýÓÃÄǸöage¸Ä±äµÄ¶ÔÏó¡£
ʵÏÖÒ»¸ö¸Ä±ä¶ÔÏó²ÎÊý״̬µÄ·½·¨²¢²»ÊÇÒ»¼þÄÑÊ¡£ÀíÓɺܼòµ¥£¬·½·¨µÃµ½µÄÊǶÔÏóÒýÓõĿ½±´£¬¶ÔÏóÒýÓü°ÆäËûµÄ¿½±´Í¬Ê±ÒýÓÃͬһ¸ö¶ÔÏó¡£
Java³ÌÐòÉè¼ÆÓïÑÔ¶Ô¶ÔÏó²ÉÓõIJ»ÊÇÒýÓõ÷Óã¬Êµ¼ÊÉÏ£¬¶ÔÏóÒýÓýøÐеÄÊÇÖµ´«µÝ¡£
ÏÂÃæ¾ÙÀý˵Ã÷Ï£º
class employer{
private String name;
private int age;
private String addr;
public employer(String a,int b,String c){
name=a;
age=b;
addr=c;
}
public void setname(String name){
this.name=name;
}
public String getname(){
return name;
}
public void setage(int age){
this.age=age;
}
public int getage(){
return age;
}
public void setaddr(String addr){
this.addr=addr;
}
public String getaddr(){
return addr;
}
}
public class tes
Ïà¹ØÎĵµ£º
1. Ñ»·listÖеÄËùÓÐÔªËØÈ»ºóɾ³ýÖظ´
public static List removeDuplicate(List list) {
for ( int i = 0 ; i < list.size() - 1 ; i ++ ) {
for ( int j = list.size() - 1 ; j > i; j -- ) {
if (list.get(j).equals(list.get(i))) {
......
½ñÌìÊÇѧϰAndroid¿ª·¢µÄµÚ¶þÌ죺
½ñÌìÖ÷ҪѧϰÁËÎļþµÄ¶ÁÈ¡¡¢ÒÔ¼°¶ÔxmlÎļþµÄ½âÎö£º
ʹÓÃÎļþ½øÐÐÊý¾Ý´æ´¢£º
ActivityÌṩÁËopenFileOutput()·½·¨¿ÉÒÔÓÃÓÚ°ÑÊý¾ÝÊä³öµ½ÎļþÖУ¬¾ßÌåµÄʵÏÖ¹ý³ÌÓëÔÚJ2SE»·¾³Öб£´æÊý¾Ýµ½ÎļþÖÐÊÇÒ»ÑùµÄ¡£
public class FileActivity extends Acti ......
תÌû×Ô http://www.javaeye.com/topic/257191
javaÖÐhashcode()ºÍequals()µÄÏê½â
1. Ê×ÏÈequals()ºÍhashcode()ÕâÁ½¸ö·½·¨¶¼ÊÇ´ÓobjectÀàÖм̳йýÀ´µÄ¡£
equals()·½·¨ÔÚobjectÀàÖж¨ÒåÈçÏ£º
public boolean equals(Object obj) {
return (this == obj);
}
ºÜÃ÷ÏÔÊǶÔÁ½¸ö¶ÔÏóµÄµØÖ·Öµ½øÐеıȽϣ¨¼´±È½Ï ......
ʹÓÃJava²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
ÕªÒª: ×î³õjavaÊDz»Ö§³Ö¶ÔÎı¾ÎļþµÄ´¦ÀíµÄ£¬ÎªÁËÃÖ²¹Õâ¸öȱº¶¶øÒýÈëÁËReaderºÍWriterÁ½¸öÀ࣬ÕâÁ½¸öÀ඼ÊdzéÏóÀ࣬WriterÖÐ write(char[] ch,int off,int
length)£¬flush()ºÍclose()·½·¨Îª³éÏó·½·¨£¬ReaderÖÐread(char[] ch,int off,int length)ºÍclose()·½·¨ÊdzéÏó·½·¨¡£×ÓÀàÓ¦¸Ã·Ö± ......
import java.net.url;
import java.sql.*;
public class javaoracle {
public javaoracle() {
}
public static void main(string[] args){
try
{
try{
class.forname("oracle.jdbc.driver.oracledriver");
}
catch(java.lang.classnotfoundexception e)
{
system.err.print(e.getmessage());
} ......