Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:01:40+00:00 2026-06-15T14:01:40+00:00

I am trying some code but I cannot compile it. is there any error?

  • 0

I am trying some code but I cannot compile it. is there any error? I have attached the code below.

import java.util.*;
import java.io.*;
import javax.swing.*;
import java.awt.event.*;

public class Node
{
  private int nodeId;
  private List<Connection> outboundConnections = new ArrayList<>();

  public Node(int nodeId)
  {
    this.nodeId = nodeId;
  }

  public void addConnection(Connection connection)
  {
    this.outboundConnections.add(connection);
  }
}

and when i compile, i got this kind of error :

Node.java:9: error: cannot find symbol

  private List<Connection> outboundConnections = new ArrayList<>();

               ^
  symbol:   class Connection

  location: class Node

Node.java:16: error: cannot find symbol

  public void addConnection(Connection connection)
                            ^
  symbol:   class Connection

  location: class Node

Node.java:9: error: unexpected type

  private List<Connection> outboundConnections = new ArrayList<>();

                                                              ^
  required: class

  found:    <E>ArrayList<E>

  where E is a type-variable:

    E extends Object declared in class ArrayList

3 errors
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:01:42+00:00Added an answer on June 15, 2026 at 2:01 pm
    private List<Connection> outboundConnections = new ArrayList<>();
    

    is only valid on Java 7+. If you run Java 6 or earlier, you need to use:

    private List<Connection> outboundConnections = new ArrayList<Connection>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to code some stuff for a game but I keep getting error
i have some code that i am trying to recompile and understand, but i
So I'm using Visual C++ 6.0, and trying to compile some source code, but
I'm trying to compile some code (below) using gcc 4.6.2 on OSX 10.6.5. It's
I have some code which compiles fine under Linux, but I am trying to
I'm trying to write some code using posix threads but I'm stuck from the
I am trying to write some code to return an array in C#, but
I'm currently trying to compile some code examples from http://developer.gnome.org/gtkmm-tutorial/unstable/sec-treeview-examples.html.en but from what I
I'm trying to write tests for some legacy code with PHPUnit 3.4.9, but it
I am trying to right-align the output of some PL/SQL code, but dbms_output.put_line is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.