@Test public void fileTest() { //创建File 对象 File file=new File("hell.txt"); //获取文件名 System.out.println(file.getName()); //访问文件的绝对路径 System.out.p...
分类:
编程语言 时间:
2014-06-18 21:22:15
阅读次数:
296
java自带替换String s="hlz_and_hourui哈哈"; String new_S=s.replaceAll("哈", "笑毛"); System.out.println(new_S);则输出为:"hlz_and_hourui笑毛笑毛"; 1 package find_repal.....
分类:
编程语言 时间:
2014-06-18 15:58:49
阅读次数:
264
使用注解进行简化aop的配置
切点是run方法
Car.java
package com.lubby.bean;
import org.springframework.stereotype.Component;
@Component("car")
public class Car {
public void run(){
System.out.println("Car i...
分类:
编程语言 时间:
2014-06-18 12:17:12
阅读次数:
269
构造方法类Bean1
package com.hao947.bean;
public class Bean1 {
public Bean1() {
System.out.println("bean1...构造方法");
}
public void show(){
System.out.println("bean1...方法");
}
}
配置文件applicationCont...
分类:
编程语言 时间:
2014-06-17 23:12:43
阅读次数:
402
Person p=new Person("黄雄");
Map map=new HashMap();
map.put("p", p);
p.setName("黄熊熊");
Person p1=(Person)map.get("p");
System.out.println(p1.getName());
输出的是黄熊熊,因为map里面存的是引用!p.setName("黄熊熊...
分类:
其他好文 时间:
2014-06-17 22:55:10
阅读次数:
229
元组将多个值组合为单个值。元组内的值可以是任意 类型,各元素不必是相同的类型。元组在作为函数返 回值时尤其有用。1、定义方法1let http404Error= (404,"Not Found")println("The status codeis \(http404Error.0)")// pri...
分类:
其他好文 时间:
2014-06-17 19:41:45
阅读次数:
172
importjava.text.DecimalFormat;
publicclassDecimalFormatTest
{
publicstaticvoidmain(String[]args){
DecimalFormatdf1,df2;
System.out.println("整数部分0/#的区别");
df1=newDecimalFormat("#.00");
df2=newDecimalFormat("0.00");
System.out.p..
分类:
其他好文 时间:
2014-06-17 17:32:15
阅读次数:
249
下面将列举一些面试中常见的关于java表达式的问题,我将结果直接以注释的形式附在后面。
问题1:
int a = 10;
int b = a + (a = 5) + a + (a = 10);
System.out.println(b);//b = 30
问题2:
int i = 1;
i = (i=i+(i+(i=2)+...
分类:
编程语言 时间:
2014-06-16 19:30:52
阅读次数:
312
package上机练习;
publicclassA02class{
Stringnames[]=newString[30];
publicvoidshowA(Stringname){
for(inti=0;i<names.length;i++){
if(names[i]==null){
names[i]=name;
break;
}
}
}
publicvoidshowB(){
System.out.println("\t客户列表显..
分类:
编程语言 时间:
2014-06-16 15:26:12
阅读次数:
287
publicclassTest
{
publicstaticvoidmain(String[]args)throwsException{
Childrenc=newChildren();
c.show();
}
}
classParent
{
publicvoidshow(){
stepOne();
stepTwo();
}
voidstepOne(){
System.out.println("parent.stepOne()");
}
voidstepTwo(){
/..
分类:
其他好文 时间:
2014-06-16 15:12:59
阅读次数:
178