You are on page 1of 3

... : ..

2
........1294........... :
.... : .....
...... : .......

........................... :
........................... :
2013/......../......... :

----


""1122
2012/2013
:

.1 .
. 2 ) (
.3 .

)(1
) (1 ) (
(
1

)(2
)

) 20( )

) (
) (
1

) 10(
6

) 15( ) 3 (

:
.1 : Class Loader .
: Byte-code Verifier
.
.2 :

: .
.3 : Overloading
.
: Overriding
.
.4 : .
: .
.5 : public .
:abstract .
:

) 30( ) 10 (

.1
29
47
1

1
0

1
0

.2
for loop i
for
a(i) == i ==

:
.a
.b
.c
:

for ( int i = 0; i<a.length ;i++)


a(i) = i;
.3

public class Main {


public static void main(String[] args) {
int i;
for( i=1 ;i<=6 ; i++){
for (int j =1; j<i ; j++){
System.out.print(j);
}
System.out.println();
}
}
}

( 10)

public class Student {


int studentId;
String studentName;
String department;
private void setName(String name)
{
studentName = name;
}
private String getName()
{
return studentName;
}

( 15)

import javax.swing.JOptionPane;
public class OddEven {
public static void main( String args[] )
{
String input,
// string entered by user
result;
// output display string
int number;
// number
// read from user as a string
input =
JOptionPane.showInputDialog( "Enter integer:" );
// convert number from type String to type int
number = Integer.parseInt( input );
if ( number % 2 == 0 )
result = "Number is even.";
else
result = "Number is odd.";
// Display results
JOptionPane.showMessageDialog(
null, result, "Calculation Results",
JOptionPane.INFORMATION_MESSAGE );
}
}

( 15)

import javax.swing.JOptionPane;
public class larger {
public static void main( String args[] )
{
String firstNumber,
// first string entered by user
secondNumber,
// second string entered by user
result;
// a string containing the output
int number1,
// first number to compare
number2;
// second number to compare
// read first number from user as a string
firstNumber =
JOptionPane.showInputDialog( "Enter first integer:" );
// read second number from user as a string
secondNumber =
JOptionPane.showInputDialog( "Enter second integer:" );
// convert numbers from type String to type int
number1 = Integer.parseInt( firstNumber );
number2 = Integer.parseInt( secondNumber );
if ( number1 > number2 )
result = number1 + " is larger.";
else if ( number1 < number2 )
result = number2 + " is larger.";
else
result = "These numbers are equal.";
// Display results
JOptionPane.showMessageDialog(
null, result, "Comparison Results",
JOptionPane.INFORMATION_MESSAGE );
}
}

You might also like