JavaÓïÑÔµÄ26¸öϸ½Ú
JavaÓïÑÔµÄ26¸öϸ½Ú[תÔØ]
Java×÷ΪһÃÅÓÅÐãµÄÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ,ÕýÔÚ±»Ô½À´Ô½¶àµÄÈËʹÓᣱ¾ÎÄÊÔͼÁгö×÷ÕßÔÚʵ¼Ê¿ª·¢ÖÐÅöµ½µÄһЩJavaÓïÑÔµÄÈÝÒ×±»È˺öÊÓµÄϸ½Ú,Ï£ÍûÄܸøÕýÔÚѧϰJavaÓïÑÔµÄÈËÓÐËù°ïÖú¡£
1£¬Î»ÒÆÔËËãÔ½½çÔõô´¦Àí
¿¼²ìÏÂÃæµÄ´úÂëÊä³ö½á¹ûÊǶàÉÙ?
int a=5;
System.out.println(a<<33);
°´ÕÕ³£ÀíÍƲâ,°Ña×óÒÆ33λӦ¸Ã½«aµÄËùÓÐÓÐЧλ¶¼ÒƳöÈ¥ÁË£¬ÄÇʣϵĶ¼ÊÇÁã°¡£¬ËùÒÔÊä³ö½á¹ûÓ¦¸ÃÊÇ0²Å¶Ô°¡£¬¿ÉÊÇÖ´Ðкó·¢ÏÖÊä³ö½á¹ûÊÇ10£¬ÎªÊ²Ã´ÄØ£¿ÒòΪJavaÓïÑÔ¶ÔλÒÆÔËËã×÷ÁËÓÅ»¯´¦Àí£¬JavaÓïÑÔ¶Ôa<<bת»¯Îªa<<(b%32)À´´¦Àí£¬ËùÒÔµ±ÒªÒÆλµÄλÊýb³¬¹ý32ʱ£¬Êµ¼ÊÉÏÒÆλµÄλÊýÊÇb%32µÄÖµ£¬ÄÇôÉÏÃæµÄ´úÂëÖÐa<<33Ï൱ÓÚa<<1£¬ËùÒÔÊä³ö½á¹ûÊÇ10¡£
2£¬¿ÉÒÔÈÃi!=iÂð£¿
µ±Äã¿´µ½Õâ¸öÃüÌâµÄʱºòÒ»¶¨»áÒÔΪÎÒ·èÁË£¬»òÕßJavaÓïÑÔ·èÁË¡£Õâ¿´ÆðÀ´ÊǾø¶Ô²»¿ÉÄܵģ¬Ò»¸öÊýÔõô¿ÉÄܲ»µÈÓÚËü×Ô¼ºÄØ£¿»òÐí¾ÍÕæµÄÊÇJavaÓïÑÔ·èÁË£¬²»ÐÅ¿´ÏÂÃæµÄ´úÂëÊä³öʲô£¿
double i=0.0/0.0;
if(i==i){
System.out.println("Yes i==i");
}else{
System.out.println("No i!=i");
}
ÉÏÃæµÄ´úÂëÊä³ö"No i!=i"£¬ÎªÊ²Ã´»áÕâÑùÄØ£¿¹Ø¼üÔÚ0.0/0.0Õâ¸öÖµ£¬ÔÚIEEE 754¸¡µãËãÊõ¹æÔòÀï±£ÁôÁËÒ»¸öÌØÊâµÄÖµÓÃÀ´±íʾһ¸ö²»ÊÇÊý×ÖµÄÊýÁ¿¡£Õâ¸öÖµ¾ÍÊÇNaN("Not a Number"µÄËõд)£¬¶ÔÓÚËùÓÐûÓÐÁ¼ºÃ¶¨ÒåµÄ¸¡µã¼ÆË㶼½«µÃµ½Õâ¸öÖµ£¬±ÈÈ磺0.0/0.0£»ÆäʵÎÒÃÇ»¹¿ÉÒÔÖ±½ÓʹÓÃDouble.NaNÀ´µÃµ½Õâ¸öÖµ¡£ÔÚIEEE 754¹æ·¶ÀïÃæ¹æ¶¨NaN²»µÈÓÚÈκÎÖµ£¬°üÀ¨Ëü×Ô¼º¡£ËùÒÔ¾ÍÓÐÁËi£¡=iµÄ´úÂë¡£
3£¬ÔõÑùµÄequals²Å°²È«£¿
ÎÒÃǶ¼ÖªµÀÔÚJava¹æ·¶ÀﶨÒåÁËequals·½·¨¸²¸ÇµÄ5´óÔÔò£ºreflexive£¨·´ÉíÐÔ£©£¬symmetric£¨¶Ô³ÆÐÔ£©£¬transitive£¨´«µÝÐÔ£©£¬consistent£¨Ò»ÖÂÐÔ£©£¬non-null£¨·Ç¿ÕÐÔ£©¡£ÄÇô¿¼²ìÏÂÃæµÄ´úÂ룺
public class Student{
private String name;
private int age;
public Student(String name,int age){
this.name=name;
this.age=age;
}
public boolean equals(Object obj){
Ïà¹ØÎĵµ£º
±¾ÎÄÖ÷Ҫ̸һÏÂÃÜÂëѧÖеļÓÃܺÍÊý×ÖÇ©Ãû£¬ÒÔ¼°ÆäÔÚjavaÖÐÈçºÎ½øÐÐʹÓ᣶ÔÃÜÂëѧÓÐÐËȤµÄ»ï°é£¬ÍƼö¿´Bruce SchneierµÄÖø×÷£ºApplied Crypotography.ÔÚjdk1.5µÄ·¢Ðа汾Öа²È«ÐÔ·½ÃæÓÐÁ˺ܴóµÄ¸Ä½ø£¬Ò²ÌṩÁ˶ÔRSAËã·¨µÄÖ±½ÓÖ§³Ö£¬ÏÖÔÚÎÒÃÇ´ÓʵÀýÈëÊÖ½â¾öÎÊÌ⣨±¾ÎĽöÊÇ×÷Ϊ¼òµ¥½éÉÜ£©£º
Ò»¡¢ÃÜÂëѧÉÏ ......
1.ÔÚÄã¾õµÃÓдíµÄµØ·½ÉèÖöϵã
2.µã»÷¼×¿Ç³æÒ»ÑùµÄ°´Å¥ÏÂÃæµÄ×Ó°´Å¥£¬Ò²ÊǼ׿dzæÒ»ÑùµÄ£¬½ÐDebug
3.ÔËÐгÌÐò£¬µ±³ÌÐòÔËÐе½¸Õ²ÅÉèÖöϵãµÄλÖþͻáÍ£ÏÂÀ´£¬²¢ÇÒÄÇÐдúÂëµ×É«»á¸ßÁÁÏÔʾ¡£
4.½Ó×ÅÄãÔÚÈçϽçÃæÄã¿ÉÒÔ¿´µ½ÄãÏëÒªµÄÐÅÏ¢
5.ÔÚVariablesÀïÃæ¿ÉÒԲ鿴ËùÓбäÁ¿µÄÖµ£¬±ÈÈç¸Õ²ÅÉèÖõĶϵãÀïÃæµÄstrClassNameµÄÖµ¾Í ......
»ñµÃmysqlºÍoracleÁ´½ÓµÄÀà
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectDB {
private static final String MYSQL = "jdbc:mysql://";
private static final String ORACLE = "jdbc:oracle:thin:@";
private ConnectD ......
/*
* GetMacAddress .java
*
* description:get Mac addreess
*
* @author hadeslee
*
* Created on 2007-9-27, 9:11:15
*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test2;
import java.io.BufferedReader;
import java.io.IO ......
ƪÎÄÕÂÊÇ×î½ü¸Õ¿´µ½µÄ£¬ËäÈ»ÊÇ˵³ÌÐòÔ±´ÓC++תJAVAÐèҪעÒâµÄµØ·½£¬µ«ÊǺÜÏêϸµÄ˵³öÁËC++ºÍJAVAµÄ²»Í¬µÄµØ·½£¬¶ÔÓÚJAVAÖÐΪʲôûÓÐÖ¸Õ롢ΪʲôûÓÐÄÚ´æй¶¡¢½Ó¿ÚºÍC++ÖжàÖؼ̳еĹØϵ¡¢Òì³£»úÖƵÈÎÊÌâÒ²ÃèÊöµÄºÜÏêϸ£¬¹ÊתÔعýÀ´¡£
1.JavaÔÚÐéÄâ»úÉÏÔËÐÐ
JavaÔ´´úÂë²¢²»ÊDZ»±àÒë³ÉΪÆÕͨµÄ»úÆ÷´úÂë¡£¶øÊDZ»·Òë³ÉÎ ......