Hello 
I am a student that is currently converting a java program into Objective-C. It was kinda hard, but I need to do it to pass my subject.
I have a little problem regarding the ".add" of Java. I read a lot of posts and books just to understand it. But I still have a hard time understanding.
I would like to check if what I did was correct and if someone can lend me a hand in converting. Help please? thanks.
Here is the java code:
here is my solution in objective-c:
I am a student that is currently converting a java program into Objective-C. It was kinda hard, but I need to do it to pass my subject.
Here is the java code:
Code:
ArrayList cid = new ArrayList();
ArrayList sid = new ArrayList();
ArrayList<String> sol = new ArrayList<String>();
public mainProgram() {
initComponents(); //.add (cartesian product principle)
sid.add("sink");
cid.add("1 /x");
here is my solution in objective-c:
Code:
NSArray *cid = [[NSArray alloc]init];
NSArray *sid = [[NSArray alloc]init];
NSMutableArray *sol = [[NSMutableArray array];
(my first trial in .add) cid addObject: @"1/x"; -----but it shows an error: "Expected ';' before 'addObject'"
(the other trial is) [sid addObject: @"sink"]; -------but it also shows an error:
"Local declaration of sid hides instance variable"
"NSArray may not respond to '-addObject'."
Last edited by a moderator: