Results 1 to 3 of 3
  1. #1
    DeathByStorm is offline Member
    Join Date
    Mar 2017
    Rep Power

    Default Program Crashing after running

    Program keeps crashing after it's done. Does anyone know what I need to do to fix it?

    Java Code:
    public class m
    	public static void main(String [] args)
    		Scanner S = new Scanner(;
    		System.out.println("Give me a String: ");
    		String s1 = S.nextLine();
    		System.out.println("Give me a number: ");
    		int n1 = S.nextInt();
    		char c = s1.charAt(n1);
    		int count = 0;
    		int j = n1;
    		while(j <= s1.length())
    			System.out.print(s1.charAt(count) + "");
    			count = count + j;
    Last edited by DeathByStorm; 03-11-2017 at 07:28 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Program Crashing after running

    crashing after it's done
    Please explain what "crashing" means.
    Copy the full text of any error message and paste it here.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Program Crashing after running

    What is the code in lines #16 ... #25 supposed to do? It doesn't make much sense to me ...

    kind regards,

    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Infinate Loop? (Crashing program)
    By kkid in forum New To Java
    Replies: 4
    Last Post: 10-02-2013, 10:22 PM
  2. Replies: 1
    Last Post: 04-24-2013, 09:42 AM
  3. why does the program keep running?
    By jwl in forum New To Java
    Replies: 1
    Last Post: 10-04-2012, 09:27 PM
  4. Not getting why the program is not running
    By jnjh in forum New To Java
    Replies: 5
    Last Post: 04-07-2011, 10:25 AM
  5. Help with running the program :)
    By dj_ee3 in forum New To Java
    Replies: 2
    Last Post: 02-27-2011, 11:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts