javaѧϰ±Ê¼Ç 2.»ù±¾Êý¾ÝÀàÐÍ
1.ÕûÊý
byte 1×Ö½Ú
short 2×Ö½Ú
int 4×Ö½Ú
long 8×Ö½Ú
2.¸¡µã
float
double
Ìáʾ
£¨1£© ¸¡µãÐ͵ÄÖµ£¬Èç¹ûûÓÐÌØ±ðÖ¸Ã÷£¬Ä¬ÈÏÊÇ double Ð͵Ä
£¨2£© ¶¨Òå float Ð͵Äʱºò£¬Ò»¶¨ÒªÖ¸Ã÷ÊÇ float Ð͵ģ¬¿ÉÒÔͨ¹ýÔÚÊý×ÖºóÃæÌí¼Ó”F”»òÕß”f”À´±íʾ¡£
3.²¼¶û
boolean
boolean truth = true; //ÉùÃ÷±äÁ¿ truth
×¢Ò⩤©¤ÔÚÕûÊýÀàÐͺÍbooleanÀàÐÍÖ®¼äÎÞת»»¼ÆËã¡£ÓÐЩÓïÑÔ£¨ÌرðÖµµÃÇ¿µ÷µÄÊÇ C ºÍC++£©ÔÊÐí½«Êý×Öֵת»»³ÉÂß¼Öµ£¨Ëùν“·ÇÁã¼´Õæ”£©,ÕâÔÚ Java ±à³ÌÓïÑÔÖÐÊDz»ÔÊÐíµÄ
£»booleanÀàÐÍÖ»ÔÊÐíʹÓà boolean Öµ£¨true»ò false£© ¡£
4.×Ö·û
char 2¸ö×Ö½Ú¿ÉÒÔ´æ·Åºº×Ö
ÔÚjavaÖУ¬¶Ôchar½øÐÐÔËËãµÄʱºò£¬Ö±½Óµ±×öascIIÂë¶ÔÓ¦µÄ
ÕûÊý¶Ô´ý
Êý¾ÝÀàÐÍ¿ÉÒÔ×Ô¶¯µÄ´ÓµÍ¾«¶È-¡·¸ß¾«¶È
·´Ö®²»¿É£¬ÒªÓÃÇ¿ÖÆÀàÐÍת»»¡£
int a=1.2 ´í£¡£¡
float a=3.4 ´í£¡£¡ 3.4ĬÈÏÊÇdoubleÀàÐÍ
Ïà¹ØÎĵµ£º
GsonÕâ¸öJavaÀà¿â¿ÉÒÔ°ÑJava¶ÔÏóת»»³ÉJSON£¬Ò²¿ÉÒÔ°ÑJSON×Ö·û´®×ª»»³ÉÒ»¸öÏàµÈµÄJava¶ÔÏó¡£GsonÖ§³ÖÈÎÒ⸴ÔÓJava¶ÔÏó°üÀ¨Ã»ÓÐÔ´´úÂëµÄ¶ÔÏó¡£
´úÂëÀý×Ó£º
util.DateºÍsql.Date±»×ª³É³¤ÕûÐÎÓÃÓÚÐòÁл¯´«Êä
public class SQLDateSer
ializer implements JsonSerializer<java.sql.Date> {
public JsonElemen ......
¼ÙÈçÄãÔÚÒ»¸öÎïÁ÷ÔËÊ乫˾£¬Óиö¿Í»§ÒªÇóÄãΪËûÔËÊäÒ»¶¨ÊýÁ¿µÄ²úÆ·µ½Ä³µØ£¬Ê¹ÓÃijÖÖ½»Í¨¹¤¾ß£®ÄÇÎÒÃǼÙÉèÄãµÄ¹ÜÀí³ÌÐòÖÐÓÐTruckÀ࣬TrainÀ࣬PlaneÀàרÃÅÓÃÀ´ÊµÏÖʹÓò»Í¬½»Í¨¹¤¾ßµÄ³É±¾¼ÆË㣬¶¼Óз½·¨cost(Double weight,Double space);ÄÇô£¬ÎÊÌâ³öÀ´ÁË£®¿Í»§¶ÔÓÚÔËÊäÆ÷ÖÖÀàÊÇ¿ÉÑ¡ÔñµÄ£¬ÄãÊDz»ÊÇÒª¶ÔÿÖÖÔËÊäÆ÷new¸öʵÀý· ......
jarÎļþÌý˵¹ýÂð£¬Ã»ÓУ¿»òÕßİÉú£¡ºÃ£¬Ã»¹ØÏµ£¬Õâ¾ÍÊÇÎÒÃǵĵÚÒ»Õ¾£º´ò°ü·¢²¼¡£
Ϊʲô»áÓÐÕâ¸öÍæÒâÄØ£¬Ê×ÏÈ£¬ÕâÊÇjarµÄÈ«³Æ£ºJavaTM Archive (JAR) file£¬Êǵ쬾ÍÊÇjava´æµµÎļþ¡£ÕâÓеãÀàËÆzipÎļþ£¬ÏëÒ»ÏëËüÊǸÉʲôµÄÓõÄÄØ£¬Ñ¹Ëõ£¡£¿Ã»´í¾ÍÊÇҪѹËõ£¬½«ÎÒÃÇÔÏÈÁãÉ¢µÄ¶«Î÷·Åµ½Ò»Ï£¬ÖØÐÂ×éÖ¯£¬ËùÓÐÕâЩĿµÄÖ»ÓÐÒ» ......
Ê×ÏÈÇë´ó¼Ò¿´¿´ÏÂÃæÁ½¶Î´úÂëÓÐÊ²Ã´Çø±ð£º
´úÂë1£º
List<Task> tasks = new ArrayList<Task>();
Task[] allTask = DemoData.getTasksData();
for(int i=0;i<allTask.length;i++){
tasks.add(allTask[i]);
}
------------------------------------- ......
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
public class ZipUtil {
public static void main(String[] args) {
&nb ......