½ØÈ¡×Ö·û´®(ÖÐÓ¢»ìºÏ´®) JAVA´úÂë
public class SplitString {
/**
* @param args
*/
public static void main(String[] args) {
String str = "ÖÐZellÖйú5000Äê,Congruations!";
int bytes = 8;
str = new SplitString().getSubString(str, bytes);
System.out.println(str);
}
public String getSubString(String str,int bytes){
int temp = bytes;
byte [] AllBytes = str.getBytes();
int AllStrByteLen = AllBytes.length;
if(bytes > AllStrByteLen | bytes <= 0){
return str;
}
int ChinaWordsNum = 0;
for(int i=0;i<temp;i++){
int IntOfByte = (int)AllBytes[i];
if(IntOfByte < 0 ){
ChinaWordsNum+=1;
}
}
if(ChinaWordsNum%2 == 0){
return new String(AllBytes,0,temp);
}else{
if(bytes == 1){
return null;
}
&
Ïà¹ØÎĵµ£º
1.JavaÀïÃæÊ¹ÓÃ
static
·½·¨ÓÐʲôºÃ´¦£¿
´ð£ºÔÚÏîÄ¿ÖУ¬¶ÔÓÚÆµ·±Ê¹Óõķ½·¨£¬Ê¹ÓÃstatic
ÐÞÊλáÌá¸ßЧÂÊÂð£¿
¾²Ì¬·½·¨µÄºÃ´¦¾ÍÊDz»ÓÃÉú³ÉÀàµÄʵÀý¾ÍÄÜÖ±½Óµ÷ÓúͶÔÏóÎÞ¹Ø
Äã²»ÓÃÉú³É¶ÔÏó¾ÍÄÜÓÃÕâ¸ö·½·¨ÁË£¬²»ÊÇÌá¸ßЧÂÊ£¿ÄãÉú³É¶ÔÏóµÃÕ¼ÓÃÄÚ´æ¿Õ¼ä°¡
ÖÁÓÚ¾²Ì¬ÊôÐÔÒ²ÄÜÌá¸ßЧÂÊ£¬ÄãÆÕͨµÄÊôÐÔÿ¸öÀà¶Ô ......
ÓÃCµÄÈËÒ»¶¨ÖªµÀ__FILE__ºÍ__LINE__,µ«ÊÇJavaÖÐ ²¢Ã»ÓÐÕâÑùµÄ¶¨Ò壬ÓÐʱºòµ÷ÊÔ¶àÏ߳̾ͺܲ»·½±ã£¬Ã»°ì·¨£¬×Ô¼º¶¯ÊÖ£¬·áÒÂ×ãʳ~ÓÃÏÂÃæµÄº¯ÊýÈ¡µÃµ±Ç°Ðкš£
º¯Êý£º
/**
*µÃµ½ExceptionËùÔÚ´úÂëµÄÐÐÊý
*Èç¹ûûÓÐÐÐÐÅÏ¢,·µ»Ø-1
*/
public static int getLineNumber(Exception e){
StackTraceElement[] trace =e.getStac ......
°¥£¡×ªÑ۾͹ýÁËÒ»ÄêÁË£¬ÎÒºÃÏñʲô¶«Î÷¶¼Ñ§²»µ½Ñ½£¬ÕâÒªÈçºÎÊǺð¡£¬ÕæµÄÐÄÀïºÜ¼±°¡£¡£¡£¡ÄĸöJAVA¸ßÊÖÖ¸µãÏÂÎÒÕâ¸öºó±²¿©£¬ÎÒ»áÍò·Ö¸ÐлÀ࣬ºÇºÇ£¬ºÜ¿ÉÄÜÊÇÎÒÀÏʦ²»Ðа¡£¡Ëý×Ô¼ºÉϿζ¼ÄÜ×ö³ö´íÎó³ÌÐò³öÀ´£¬»¹ôòÊǸöÈ˲ţ¬ÎÒ²»µÃ²»Åå·þËý°¡£¬ÎÒÃǰàÉÏÒ²ÓкöàÈËÔÚ˵ËýÊÇÔõôÔõôµÄ²î£¬°¥£¡ÎÒ¶¼²»Ï ......
Ò»¡¢ÏòÉÏתÐÍ¡£
ͨË׵ؽ²¼´Êǽ«×ÓÀà¶ÔÏóתΪ¸¸Àà¶ÔÏó¡£´Ë´¦¸¸Àà¶ÔÏó¿ÉÒÔÊǽӿڡ£
1£¬ÏòÉÏתÐÍÖеķ½·¨µ÷Óá£
¿´ÏÂÃæ´úÂ룺
package com.wensefu.others;
public class Animal {
public void eat(){
System.out.println("animal eatting...");
}
}
class Bird extends Animal{
public void ......
1.
BufferedReader in = new BufferedReader(new FileReader("Ô¶³ÌÎļþ"));
in.readLine() ;
l ʹÓà Java ²Ù×÷Îı¾ÎļþµÄ·½·¨Ïê½â
http://java.ccidnet.com/art/3737/20041108/523627_1.html
l FileReader ÊÇʲôÀࣿºÍ FileInputStream ÓÐʲô²»Í¬£¿£¿£¿
ht ......