Question: ```
 int sum(int a,int b) 
     {
         Scanner S1= new Scanner(System.in);
         throw  new ArithmeticException ( "Error");
         System.out.println("Enter   Any  Two Number" );// why Not i'm able to Use  This line while returning .
         a=S1.nextInt();
         b=S1.nextInt();
         return a+b;       

     }

```

Answer: 
The issue is that you're creating this controller in your `main` function, but don't do anything with it and it will fall out of scope (and if using ARC, will be deallocated). Regardless, when the view controller is instantiated during the standard flow of the app, it will create a second instance, this time without having `createButton` called. So your calling of `createButton` in `main` is for naught. This concept of "I create an object in main class just to start it quickly" doesn't pass muster. The creating of the view controller in `CreateButtons` suffers from an analogous problem.

You really need to set the `stream` property somewhere else (e.g. in the `viewDidLoad` of `PlayVideoController` or in the `prepareForSegue` of the view controller that is segueing to `PlayVideoController`). But you almost certainly will never call `initWithString` for `PlayVideoController` (and you probably can retire that method). 

If, for example, you're transitioning from `ButtonsController` view controller to `PlayVideoController` view controller via a segue with a storyboard identifier of, say `playVideo`, then you could use `prepareForSegue` in `ButtonsController` like so:

```
#import "PlayVideoController.h"

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([segue.identifier isEqualToString:@"playVideo"]){
        PlayVideoController *controller = (PlayVideoController *)segue.destinationViewController;
        controller.stream = @"--somestring--";
    }
}

```

(See the "Passing data forward using segues" section of [this answer about passing data between controllers](https://stackoverflow.com/a/9736559/1271826).)

If you want to do something at startup, e.g. initialize some model object structure (but not view controllers), you can do that in your app delegate's `didFinishLaunchingWithOptions`, but there's nothing shared with us thus far that seems to suggest that this is necessary. But if you do this, make sure you do the necessary memory management to keep it around (e.g. make this model object a property of the app delegate, make it a singleton, etc.). But if you create a local variable and configure it and let it fall out of scope, you'll lose the work you did on that.
You should update your PlayVideoController.h file as below

```
#import <UIKit/UIKit.h>

@interface PlayVideoController : UIViewController

@property (strong, nonatomic) NSString *stream;
@property (weak, nonatomic) IBOutlet UIWebView *player;

- (void) playTheVideo;
- (id) initWithString: (NSString*) theStream;

@end

```

It should work.