Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JAVA×Ö·û´®´¦Àíº¯ÊýÁбíÒ»ÀÀ

JavaÖеÄ×Ö·û´®Ò²ÊÇÒ»Á¬´®µÄ×Ö·û¡£µ«ÊÇÓëÐí¶àÆäËûµÄ¼ÆËã»úÓïÑÔ½«×Ö·û´®×÷Ϊ×Ö·ûÊý×é´¦Àí²»Í¬£¬Java½«×Ö·û´®×÷ΪStringÀàÐͶÔÏóÀ´´¦Àí¡£½«×Ö·û´®×÷ΪÄÚÖõĶÔÏó´¦ÀíÔÊÐíJavaÌṩʮ·Ö·á¸»µÄ¹¦ÄÜÌØÐÔÒÔ·½±ã´¦Àí×Ö·û´®¡£ÏÂÃæÊÇһЩʹÓÃƵÂʱȽϸߵĺ¯Êý¼°ÆäÏà¹Ø˵Ã÷¡£
substring()
ËüÓÐÁ½ÖÖÐÎʽ£¬µÚÒ»ÖÖÊÇ£ºString substring(int startIndex)
µÚ¶þÖÖÊÇ£ºString substring(int startIndex,int endIndex)
concat() Á¬½ÓÁ½¸ö×Ö·û´®
replace() Ìæ»»
ËüÓÐÁ½ÖÖÐÎʽ£¬µÚÒ»ÖÖÐÎʽÓÃÒ»¸ö×Ö·ûÔÚµ÷ÓÃ×Ö·û´®ÖÐËùÓгöÏÖij¸ö×Ö·ûµÄµØ·½½øÐÐÌæ»»£¬ÐÎʽÈçÏ£º
String replace(char original,char replacement)
ÀýÈ磺String s=”Hello”.replace(’l',’w');
µÚ¶þÖÖÐÎʽÊÇÓÃÒ»¸ö×Ö·ûÐòÁÐÌæ»»ÁíÒ»¸ö×Ö·ûÐòÁУ¬ÐÎʽÈçÏ£º
String replace(CharSequence original,CharSequence replacement)
trim() È¥µôÆðʼºÍ½áβµÄ¿Õ¸ñ
valueOf() ת»»Îª×Ö·û´®
toLowerCase() ת»»ÎªÐ¡Ð´
toUpperCase() ת»»Îª´óд
length() È¡µÃ×Ö·û´®µÄ³¤¶È
Àý£º
char chars[]={’a',’b’.’c'};
String s=new String(chars);
int len=s.length();
charAt() ½ØÈ¡Ò»¸ö×Ö·û
Àý£º
char ch;
ch=”abc”.charAt(1);
·µ»ØֵΪ’b’
getChars() ½ØÈ¡¶à¸ö×Ö·û
void getChars(int sourceStart,int sourceEnd,char target[],int targetStart)
sourceStart Ö¸¶¨ÁË×Ó´®¿ªÊ¼×Ö·ûµÄϱê
sourceEnd Ö¸¶¨ÁË×Ó´®½áÊøºóµÄÏÂÒ»¸ö×Ö·ûµÄϱꡣÒò´Ë£¬×Ó´®°üº¬´ÓsourceStartµ½sourceEnd-1µÄ×Ö·û¡£
target Ö¸¶¨½ÓÊÕ×Ö·ûµÄÊý×é
targetStart targetÖпªÊ¼¸´ÖÆ×Ó´®µÄϱêÖµ
Àý£º
String s=”this is a demo of the getChars method.”;
char buf[]=new char[20];
s.getChars(10,14,buf,0);
getBytes()
Ìæ´úgetChars()µÄÒ»ÖÖ·½·¨Êǽ«×Ö·û´æ´¢ÔÚ×Ö½ÚÊý×éÖУ¬¸Ã·½·¨¼´getBytes()
Àý£º
String s = “Hello!ÄãºÃ£¡”;
byte[] bytes = s.getBytes();
toCharArray()
Àý£º
String s = “Hello!ÄãºÃ£¡”;
char[] ss = s.toCharArray();
equals()ºÍequalsIgnoreCase() ±È½ÏÁ½¸ö×Ö·û´®
regionMatches() ÓÃÓڱȽÏÒ»¸ö×Ö·û´®ÖÐÌض¨ÇøÓòÓëÁíÒ»Ìض¨ÇøÓò£¬ËüÓÐÒ»¸öÖØÔصÄÐÎʽÔÊÐíÔڱȽÏÖкöÂÔ´óСд¡£
boolean regionMatches(int startIndex,String str2,int
str2StartIndex,int numChars)
boolean


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

JavaÖеÄö¾ÙÀàÐÍ£¬enum

public class MyEnumTestMain {
public enum MyenumTest{red,blue,green,black}//¶¨Òåö¾ÙÀàÐÍ

public static void main(String[] args) {
MyenumTest mt = MyenumTest.red;//redÏ൱ÓÚö¾ÙµÄ¾²Ì¬ÊôÐÔ

switch(mt){
case red:
System.out.println("red");
break;
case blue:
......

JavaµÄ¿çƽ̨¾ÍÊÇÒ»¾ä»ÑÑÔ¡£

ʵ²»ÏàÂ÷£¬JavaÊÇÎÒ¼û¹ýµÄÖ´ÐÐЧÂÊ×îµÍµÄ³ÌÐòÉè¼ÆÓïÑÔ£¬Ç°²»¾ÃÔÚCSDNÂÛ̳ÉÏÓиöÆÀ²â£¬¼ÆËã9999µÄ½×³Ë£¬Í¬ÑùµÄÑ­»·Ëã·¨£¬JavaµÄºÄʱÊÇ.NETµÄ5±¶¡£ÎÒÒÔÇ°ºÜϲ»¶Serv-U£¬×Ô´ÓËüÓÃJavaÖØд֮ºóÎÒ¾ÍÔÙҲûÓùý£¬ÊµÔÚÊÇÌ«ÂýÁË£¬ÎÒÄþ¿ÉÓÃIIS´î½¨FTP£¬ËäÈ»IIS´î½¨FTPÔÚȨÏÞ¹ÜÀíÉϺܲ»Áé»î¡£
ÎÒÓиöͬѧ£¬ËûÊǸãJavaµÄ£¬Ëû¸øÎÒ˵&ld ......

JAVA NIO TCP SOCKET ÁÄÌìȺ·¢(²¢·¢¶àÏß³ÌдÏûϢƪ)

·þÎñÆ÷ÖÐתÏûÏ¢£¬ÊÇ·ÑʱµÄÊ£¬¿ÉÒÔ¼ÓÈë¶àÏ̡߳£ÕâÑùÒÔÀ´£¬»á²úÉúºÜ¶àÏ̡߳£¿ÉÒÔÔËÓÃÏ̳߳ØÀ´¹ÜÀí¡£
ÕâÀïÔËÓÃjava.util.concurrent°üµÄExecutors.newCachedThreadPoolÀ´¹ÜÀí¡£
·Ï»°ÉÙ˵£¬ÉÏ´úÂ룺
·þÎñÆ÷¶Ë£ºMySocketServer.java
/*
 * To change this template, choose Tools | Templates
 * and open the ......

¡¾JAVAѧϰ±Ê¼Ç¡¿01 ±êÖ¾·ûºÅ¡¢¹Ø¼ü×Ö¡¢ÀàÐÍ

Ò»¡¢JAVAÖж¨ÒåÁËÈýÖÖ×¢ÊÍÀàÐÍ£º
//µ¥ÐÐ×¢ÊÍ——×¢Ê͵½ÐÐβ
/*¶àÐÐ×¢ÊÍ*/
/**¿ÉÒÔÓÃÓÚÎĵµ´¦ÀíµÄµ¥ÐлòÕ߶àÐÐ×¢ÊÍ*/
// µ¥ÐÐ×¢ÊÍ
/*
¶àÐÐ×¢ÊÍ£¬´ËÄÚÈÝÒ²²»»á±»Ö´ÐÐ
*/
/**
Îĵµ×¢ÊÍ£¬ÓÐרÃŵŤ¾ß
*/
public class JavaDemo01
{
// Ö÷·½·¨
public static void main(String args[])
{
// Ô ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ