Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: java code help error

  1. #1
    Junior Member
    Join Date
    Sep 2021
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post java code help error

    main. java

    import java.util.*;

    public class Main
    {

    public static void main(String[] args)
    {
    Arraylist1 integers = new Arraylist1(5);

    integers.insertIntegers();
    integers.displayIntegers();
    }
    }
    Arraylist1.java
    import javax.swing.*;
    import java.util.*;
    import java.io.*;

    public class Arraylist1
    {
    Scanner s = new Scanner(System.in);

    ArrayList<Integer> integers;
    int totalIntegers;

    public Arraylist1(int size)
    {
    totalIntegers = size;
    integers = new ArrayList<Integer>();
    }
    public void insertIntegers()
    {
    for(int i = 0; i < totalIntegers; i++)
    {
    System.out.println("Enter numbers");
    int numberss = s.nextInt();
    integers.add(numberss);
    }
    }
    public void displayIntegers()
    {
    System.out.println("Numbers: "+numberss);
    }
    }

    please fix the error in there is the System.out.println("Numbers: "+numberss);
    i dont know how to fix this problem
    please help me
    solved
    Last edited by ericerikerickk; September 13th, 2021 at 04:33 AM. Reason: solved

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: java code help error

    the error in there is
    Please copy the full text of the error message and paste it here. It has important info about the error.

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.

    http://www.java-forums.org/misc.php?do=bbcode#code
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: May 8th, 2014, 06:25 AM
  2. java code error
    By jamesmyson in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 5th, 2013, 07:49 PM
  3. Java Eclipse Code Error
    By eqs.2000 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 28th, 2013, 01:37 PM
  4. Cannot find symbol error in my java code
    By haliza hadi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 20th, 2013, 07:20 PM
  5. Replies: 1
    Last Post: January 17th, 2013, 07:04 AM