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
{ 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
相关文章推荐
- SCJP学习笔记
- 参加SCJP认证时学习的笔记
- scjp学习笔记3
- scjp学习笔记2
- 参加SCJP认证时学习的笔记 .
- 《SCJP试题1000例》学习笔记1
- 《SCJP试题1000例》学习笔记2
- java期末复习之SCJP题库学习笔记
- Linq学习笔记
- JAVA基础18天速成学习笔记之第13天
- ubuntu 操作系统学习笔记之用户与用户组
- 建筑建模学习笔记3——Vray渲染及PS修图
- spring-boot学习笔记
- 设计模式学习笔记--命令模式
- July深度学习笔记之图像检测、NeuralStyle
- 第三章-----Nginx 架构初探(学习笔记)
- jQuery的deferred对象学习笔记
- IDA学习笔记 函数调用约定
- C++ 使用头文件 - 学习笔记(6)
- C++学习笔记之模板