“PIE UNIVERSITY OF DODOMA
INFORMATICS AND VIRTUAL x
COLLEGE OF DUCATION
SCHOOL OF INFORMATICS j :
J f A Sea ter
FIRST SEMESTER 2015/2016
CS 213: OBJECT ORIENTED PROGRAMMING IN JAVA a
Date: 3" February 2016
‘Time Allocated: 90 Minutes7K 4, Identify error in the following piece of code. [2 marks]
class A
ers int ag 40;
public static void main(String
1 Me ees
args{})
SyS@m.out.print(a);
SK 5. What will be the output of this pro ? [3 marks}
class Animal
{
public String x
public Animal()
f
System.out.print("
} =
I
inimate "):
public class Dog extends Animal
{
public Dog()
yi
stem. out.prini("barking ");
public static void main(String[] args)
{
new Dogt).2o();
} at
void gov)
System.out.print(this.x + super.x);
) :
Page 2 of 2