You need to sign in to do that
Don't have an account?
Navneeth Raj
Basic Program Error
public class StudentNew
{
public string name;
public static decimal fee=10000;
public void setData(string name)
{
this.name=name;
fee=fee+1000;
}
public static getData(decimal fee)
{
fee=fee+5000;
}
}
This generates error "Duplicate variable fee". bt if i change fee to another word in getData method it says constructor cannot have static (but it is not constructor is it). am i doing it wrong or if so correct me. Please reply
{
public string name;
public static decimal fee=10000;
public void setData(string name)
{
this.name=name;
fee=fee+1000;
}
public static getData(decimal fee)
{
fee=fee+5000;
}
}
This generates error "Duplicate variable fee". bt if i change fee to another word in getData method it says constructor cannot have static (but it is not constructor is it). am i doing it wrong or if so correct me. Please reply
Please try following code:
If its helps, please mark as best answer so it will help to other who will serve same problem.
Thanks!
All Answers
Cause: You are trying to define duplicate variable "fee" in function
Please try following code:
If its helps, please mark as best answer so it will help to other who will serve same problem.
Thanks!
In above code we were not specifing return type for "getDate" method so it will consider as Constructor Please use following code:
If its helps, please mark as best answer so it will help to other who will serve same problem.
Thanks!
Sorry, different errors comes on. why it gives these errors.
Please try following code:
If its helps, please mark as best answer so it will help to other who will serve same problem.
Thanks!
Hello,
Please try with below code.
Thanks & Cheers,
Jigar(pateljb90@gmail.com)