文章列表
public class testN {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
testN n=new testN();
double m = n.getall(5);
System.out.println(m);
}
public double getall(int a){
if(a==1) return 1;
else
return a*geta ...
- 2009-04-17 14:39
- 浏览 749
- 评论(0)
public class WeekOfMonth {
/**
* @param args
*/
public static void main(String[] args) {
String str = "2008-10-12";
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
try {
calendar.setTime(formatter.pa ...
- 2009-04-17 14:32
- 浏览 644
- 评论(0)
引用public class wwww {
/* public static void main(String[] args) throws CloneNotSupportedException {
Calendar cal = Calendar.getInstance();
//int year = cal.get(Calendar.YEAR);
int Month =cal.get(Calendar.MONTH)+1;
System.out.println(Month);
cal.add(cal.MONTH, -1);
int saleMonth = ...
- 2009-04-17 14:28
- 浏览 1412
- 评论(0)
public class substr {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
substr s= new substr();
String b = s.getString("我ABC汉DEF", 5);
System.out.println(b);
}
public String getString (String stringname,int a){
String name1 ...
- 2009-04-17 14:20
- 浏览 1292
- 评论(1)
public class test {
public static void main(String[] args) {
String s="abcdefga";
/* char[] b=a.toCharArray();
System.out.println(b[0]);
StringBuffer buf=new StringBuffer();
for (int j = b.length-1; j>-1 ; j--) {
buf.append(b[j]);
}
System.out.println(buf.toString ...
- 2009-04-17 14:18
- 浏览 780
- 评论(0)
引用 public class random
{
public static void main(String argv[])
{
StringBuffer oldstr=new StringBuffer();
StringBuffer newstr=new StringBuffer();
Set s=new HashSet();
do{
char c=ran();
s.add(c);
}while(s.siz ...
- 2009-04-17 14:14
- 浏览 676
- 评论(0)
字符串中每个字符出现的次数
- 博客分类:
- java基础
引用public class WordCounts {
public static void main(String[] args){
String strTemp = "asdjfo8ifsdkfncnvfaklfdsa;";
Map tree = new HashMap<String, Integer>();
char ch;
for(int i = 0;i<strTemp.length();i++){
ch=strTemp.charAt(i);
if(t ...
- 2009-04-17 14:07
- 浏览 1271
- 评论(0)