JAVAµÄĬÈÏ×Ö·û±àÂë
´ó¼Ò¶¼ËµjavaʹÓõÄ×Ö·û¼¯ÊÇunicode£¬ÄÇôĬÈϱàÂë²»¾ÍÊÇÓ¦¸ÃÊÇUTF8,UTF16Ö®ÀàµÄunicode±àÂëÂð£¿
¿ÉÊǵ÷ÓÃCharset.defaultCharset()µÄ½á¹û²¢·ÇÈç´Ë¡£
import java.nio.charset.Charset;
public class javaCode {
public static void main(String args[])
{
String defaultCharsetName=Charset.defaultCharset().displayName();
System.out.println("defaultCharsetName:"+defaultCharsetName);
}
}
Ö´Ðнá¹ûÈçÏÂ
defaultCharsetName:GBK
¶à´ÎÊÔÑé·¢ÏÖ£¬Õâ¸öĬÈÏ×Ö·û±àÂëÊÇÓÉwindowsµÄÓïÑÔµØÓòÀïµÄÉ趨¾ö¶¨µÄ
Õâ¸ö×Ö·û±àÂë¿Ï¶¨²»ÊÇjavaÄÚ²¿µÄ×Ö·û±àÂ룬Äǻ᲻»áÊÇÎļþ¶ÁÈëʱµÄ×Ö·û±àÂ룿
ÏÈÓÃEmeditorÖ®ÀàµÄ±à¼Æ÷£¬Éú³ÉÒ»¸öUTF8µÄtxtÎļþ£¬ÊäÈëÄÚÈÝ£º門(door)£¬±£´æ¡£
ÓÃÏÂÃæµÄ´úÂë¶ÁÈë
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
public class javaCode {
public static void main(String args[])
{
String defaultCharsetName=Charset.defaultCharset().displayName();
System.out.println("defaultCharsetName:"+defaultCharsetName);
try {
InputStream is = new FileInputStream("F:\\shifjst.txt");
//µÈÓÚ InputStreamReader streamReader = new InputStreamReader(is,Charset.defaultCharset());
InputStreamReader streamReader = new InputStreamReader(is);
char[] chars = new char[10];
streamReader.read(chars, 0, 10);
System.out.println(chars);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
½á¹ûÊÇÂÒÂ룺
defaultCharsetName:windows-31j
髢?door)
ÔÙ°ÑÄǸöÎļþµÄ¸ñʽ¸Ä³Éshift-jis,ÕýÈ·¶Á³öÀ´ÁË¡£
defaultCharsetName:windows-31j
門(door)
¿´À´£¬java¶ÁÈëÎļþʱµÄ×Ö·û±àÂëÊǸù¾ÝϵͳµÄĬÈϱàÂëÀ´µÄ¡£
Ïà¹ØÎĵµ£º
Ò»£® InputºÍOutput
1. stream´ú±íµÄÊÇÈκÎÓÐÄÜÁ¦²ú³öÊý¾ÝµÄÊý¾ÝÔ´£¬»òÊÇÈκÎÓÐÄÜÁ¦½ÓÊÕÊý¾ÝµÄ½ÓÊÕÔ´¡£ÔÚJavaµÄIOÖУ¬ËùÓеÄstream£¨°üÀ¨InputºÍOut stream£©¶¼°üÀ¨Á½ÖÖÀàÐÍ£º
1.1 ÒÔ×Ö½ÚΪµ¼ÏòµÄstream
ÒÔ×Ö½ÚΪµ¼ÏòµÄstream£¬±íʾÒÔ×Ö½ÚΪµ¥Î»´ÓstreamÖжÁÈ¡»òÍùstreamÖÐдÈëÐÅÏ¢¡£ÒÔ×Ö½ÚΪµ¼ÏòµÄstream°üÀ¨ÏÂÃæ¼¸Ö ......
¡¡¡¡ËäÈ»JavaScriptÓëJavaÓнôÃܵÄÁªÏµ£¬µ«È´ÊÇÁ½¸ö¹«Ë¾¿ª·¢µÄ²»Í¬µÄÁ½¸ö²úÆ·¡£JavaÊÇSUN¹«Ë¾ÍƳöµÄÐÂÒ»´úÃæÏò¶ÔÏóµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬ÌرðÊʺÏÓÚInternetÓ¦ÓóÌÐò¿ª·¢£»¶øJavaScriptÊÇNetscape¹«Ë¾µÄ²úÆ·£¬ÆäÄ¿µÄÊÇΪÁËÀ©Õ¹Netscape Navigator¹¦ÄÜ,¶ø¿ª·¢µÄÒ»ÖÖ¿ÉÒÔǶÈëWebÒ³ÃæÖеĻùÓÚ¶ÔÏóºÍʼþÇý¶¯µÄ½âÊÍÐÔÓïÑÔ, ËüµÄÇ°ÉíÊ ......
/**
* µÃµ½±¾ÖÜÖÜÒ»
*
* @return yyyy-MM-dd
*/
public static String getMondayOfThisWeek() {
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
da ......
Java¼ò½é
¡¡¡¡JavaÊÇÓÉSun Microsystems¹«Ë¾ÓÚ1995Äê5ÔÂÍƳöµÄJava³ÌÐòÉè¼ÆÓïÑÔ£¨ÒÔϼò³ÆJavaÓïÑÔ£©ºÍJavaƽ̨µÄ×ܳơ£ÓÃJavaʵÏÖµÄHotJavaä¯ÀÀÆ÷£¨Ö§³ÖJava applet£©ÏÔʾÁËJavaµÄ÷ÈÁ¦£º¿çƽ̨¡¢¶¯Ì¬µÄWeb¡¢Internet¼ÆËã¡£´Ó´Ë£¬Java±»¹ã·º½ÓÊܲ¢Íƶ¯ÁËWebµÄѸËÙ·¢Õ¹£¬³£ÓõÄä¯ÀÀÆ÷ÏÖÔÚ¾ùÖ§³ÖJava applet¡£ÁíÒ»·½Ã棬Java ......
SpringÄÜÓÐЧµØ×éÖ¯J2EEÓ¦Óø÷²ãµÄ¶ÔÏó¡£²»¹ÜÊÇ¿ØÖƲãµÄAction¶ÔÏ󣬻¹ÊÇÒµÎñ²ãµÄService¶ÔÏ󣬻¹Êdz־òãµÄDAO¶ÔÏ󣬶¼¿ÉÔÚSpringµÄ¹ÜÀíÏÂÓлúµØе÷¡¢ÔËÐС£Spring½«¸÷²ãµÄ¶ÔÏóÒÔËÉñîºÏµÄ·½Ê½×éÖ¯ÔÚÒ»Æð£¬Action¶ÔÏóÎÞÐë¹ØÐÄService¶ÔÏóµÄ¾ßÌåʵÏÖ£¬Service¶ÔÏóÎÞÐë¹ØÐij־òã¶ÔÏóµÄ¾ßÌåʵÏÖ£¬¸÷²ã¶ÔÏóµÄµ÷ÓÃÍêÈ«ÃæÏò½Ó ......