java - Why am I getting NullPointerException when running this code? -


Why I'm having a NullPointerException while running this code, I've seen what it is and still not okay Understanding this; help please? Import java.util.Scanner; Public class test {public static zero main (string [] args) {scanner sc = new scanner (System.in); Println (); String user = sc.nextLine (); Four [] pass = system.console (). ReadPassword (); Println (passed); Char c = sc.next () Fourat (0); Println (c); Char d = sc.findInLine ("a"). Chart (0); Println (d); Char b = sc.next (). Fourat (0); Println (b); Println (user); }}

When running the code, using the variable char b is running fine up to the last two rows, the error output output is as follows:

Try the following:

  import java.util.Scanner; Public class test {public static zero main (string [] args) {scanner sc = new scanner (System.in); Println (); String user = sc.nextLine (); Four [] pass = system.console (). ReadPassword (); Println (passed); Char c = sc.next () Fourat (0); Println (c); String d = sc.next (); Bullion included; If (d.contains ("a")) {root = true; } Other (Contained = false;} System.out.println (d); System.out.println (containing "one included?"); Char b = sc.next (). Fourat (0); Println (b) ); Println (user);}}   

It will still check if it is in the letter a string though back to true Or false .

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -