You are not logged in. Please login at www.codechef.com to post your questions!

×

Exception in thread "main" java.lang.NullPointerException at ANKTRAIN.main(Main.java:11)

I dont understand why this runtime error pops,whenever i try to run on codchef online IDE,whereas on other IDE it works perfectly fine with sample inputs and other inputs as well.

import java.io.*;
import java.util.*;
class ANKTRAIN
{

    public static void main(String args[]) throws java.io.IOException 
{

       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        long t =Long.parseLong(br.readLine().trim());

asked 07 Dec '16, 15:09

raghaw's gravatar image

2★raghaw
21
accept rate: 0%

edited 21 Apr, 12:31

vijju123's gravatar image

3★vijju123
2.8k18


You may use java.util.Scanner for this.

Scanner sc = new Scanner(System.in);

long t = sc.nextLong();

link

answered 21 Apr, 13:20

onkarnandedkar's gravatar image

3★onkarnandedkar
11
accept rate: 0%

fed up with the same problem.........

link

answered 21 Apr, 10:29

rajyelchuri's gravatar image

2★rajyelchuri
1
accept rate: 0%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Tags:

×860
×21
×5

Asked: 07 Dec '16, 15:09

Seen: 374 times

Last updated: 21 Apr, 13:20