Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6948909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:53:04+00:00 2026-05-27T13:53:04+00:00

I am new to iPhone development and Objective C. I have decided I would

  • 0

I am new to iPhone development and Objective C. I have decided I would do some tutorials on Objective C first to get the hang of the language, however there a few things I am unsure about and would be grateful if someone could explain them to me.

I have downloaded Xcode 4.2 from app store, so am using.

First question, can you only have one main class in objective C? I am going through the NewBoston tutorials at the moment, and he has many different tutorials, and I am used to Java programming, where I just create a new class for each tutorial. In Objective C however, when you create a new project, you get a file called main.m which seems to be default class which always executes. I am used to java, where when you just create one project, and can have as many classes as you want within it and can just choose which class you want to run. Can you not do something like this in Objective C? Or do I have to create a new project for each tutorial I do? As I don’t want to keep just changing the main class, when I finish a tutorial I like to keep the file so I can go back and check on it if I ever forget anything.

And second quick question about the main method in Objective C. The main method is declared like this

int main(int argc, char *argV[]){

Why is the main method an int declaration? I am used to Java, where main method is void as main methods don’t return anything. It seems odd to me that the main method for Objective C is an int. Just would be nice to understand.

Thanks in advance for any help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:53:05+00:00Added an answer on May 27, 2026 at 1:53 pm

    1) In Objective-C you have one main function that gets run at startup. Combined with the fact that the iOS runtime does some initialization, too, and get that information from the project info (e.g. startup Storyboard / NIB) you can only have one entry point per project. This somewhat stems from the fact that while Java maintains a lot of namespace info and has no predifined entry point per se, Objective-C does compile everything down to one file and looks for the one function called main. You could see this like a jar-file which has a predefined entry point set on its own; only you cannot change the name of the entry point.

    2) The return type of main: For a long time, programs had return codes to indicate success (return code 0) or failure (return code greater than zero, mostly documented in man pages etc.). Actually you do have the same in Java, have a look at System.exit(int exitcode), Java simply has some default-handling as in man cases return codes are not needed anymore (especially when writing GUI applications).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Objective-C and iPhone development and have been using Apress' Beginning iPhone
I am new to objective C and iPhone game development. I am having some
I am new in iPhone development and Objective-C. I have RootViewController and DetailViewController. I
First of all, thank God for Stack Overflow. I am new at Objective-C/Cocoa/iPhone development,
I am new to objective-c and started iphone application development. I have noticed the
I'm new to iphone development.I have practiced some view based application programs and console
So new to objective-c and iphone/ipad development. Trying to get my feet wet with
I'm pretty new to Objective C and iPhone development and have hit a problem
I'm new with objective-c (and obviously iphone development) and I have to dynamically create
I'm new to iPhone development, and am sort-of getting there with pointers in Objective-C.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.