You need to sign in to do that
Don't have an account?
Compile time error
Hello all,
This code having error while compiling I.e. Incompatible element type Another.Runtime for collection of Integer at line 20 column 17. Friends I'm not able to understand this error, please let me know if you can figureout this error.
Public class Another
{
public class Runtime
{
Public string name;
Public boolean Exist;
public Integer Phone;
}
public List<Runtime> RuntimeList (List<Runtime> LR)
{
return LR;
}
public List<Integer> Phonenumbers (List<Integer> Phnumber)
{
List<integer> Allrecords = new List<integer> ();
for(Runtime IT : Phnumber)
{
If(IT!=null)
{
Allrecords.add(IT);
}
}
}
}
This code having error while compiling I.e. Incompatible element type Another.Runtime for collection of Integer at line 20 column 17. Friends I'm not able to understand this error, please let me know if you can figureout this error.
Public class Another
{
public class Runtime
{
Public string name;
Public boolean Exist;
public Integer Phone;
}
public List<Runtime> RuntimeList (List<Runtime> LR)
{
return LR;
}
public List<Integer> Phonenumbers (List<Integer> Phnumber)
{
List<integer> Allrecords = new List<integer> ();
for(Runtime IT : Phnumber)
{
If(IT!=null)
{
Allrecords.add(IT);
}
}
}
}
Please change our code as mentioned below :
Phnumber is list of Integer and you are using Runtime that's why error is coming.
Hope that helps you.
Regards,
Abhishek.
All Answers
Please change our code as mentioned below :
Phnumber is list of Integer and you are using Runtime that's why error is coming.
Hope that helps you.
Regards,
Abhishek.