您的位置:首页 > 其它

scjp学习笔记

2008-01-24 23:28 274 查看
public static void main( String args[] )

{ int a = 5;

System.out.println( cube( a ) );

}

static int cube( int theNum )

{

return theNum * theNum * theNum;

}

===========================================

int dayhigh[] = { 24,23,24,25,25,23,21 };

int[] dayhigh = { 24,23,24,25,25,23,21 };

===================================================

int[]a[] = new int[5][5];
==================================

If val = 1 in the code below:





switch( val )

{ case 1: System.out.print( "P" ); //break;

case 2:

case 3: System.out.print( "Q" );

break;

case 4: System.out.print( "R" );

default: System.out.print( "S" );

} 结果:PQ 有 break;结果:P 若val=100 结果:S

==========================================

the FileOutputStream constructor:

FileOutputStream(FileDescriptor fd)
FileOutputStream(String n, boolean a)
FileOutputStream(File f)

===============================================



class Base {
public void method(int i) {
System.out.println("Value is " + i);
}
}

public class Sub extends Base {
public void method(int j) {
System.out.println("This value is " + j);
}
public void method(String s) {
System.out.println("I was passed " + s);
}
public static void main(String args[]) {
Base b1 = new Base();
Base b2 = new Sub();
b1.method(5);
b2.method(6);
}
}
结果:Value is 5
This value is 6
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: