1. Kingdom of Saudi Arabia
Imam Mohammad bin Saud Islamic University
Collage of Computer and Information Science
First semester – 2016
CS 141
Name: ………………………………………….
ID: ……………………………………………...
Quiz1
Find the errors (syntax, runtime) and correctthem in the following code
segment:
class A{
private final int a1;
private int a2;
public A(){}
public A(int a1, int a2){
this.a1=a1;
this.a2=a2;
}
public void seta2(int a2){
this.a2=a2;
}
}
class B{
A AA;
public B(int i){
AA.seta2(i);}
}
class C extends B {
private int c1;
}
Error Correction