"8. For instance" not working


I have no idea why I can't get this to work, can anybody please help?

My code is:

class Person
  def initialize(name, profession, age)
    @name = name
    @profession = profession
    @age = age

Error message is:

"Oops, try again. It looks like your @age instance variable isn't set equal to the age parameter passed to your initialize method."




class Test
String name;
int age;
Test(String name,int age)//variables have local scope
this.name=name;//we do following steps to make global scope for name,age(instance variables)

public static void main(String args[])

 Test i =new Test("adf",12);//object creation and constructor calling



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.