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

  • SEARCH
  • Home
  • 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 8863211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:55:13+00:00 2026-06-14T15:55:13+00:00

defined variable: LinkedList list1=new LinkedList(); Object get() in list1 obtains a node of list1

  • 0

defined variable:

 LinkedList list1=new LinkedList();

Object get() in list1 obtains a node of list1

Object remove() in list1 deletes a node of list1

count() is length of list1

for(int i=1;i<list1.count();i++){
  if(list1.get(i).startsWith('"',0)) //Error here
    list1.remove(i);
}

Error: cannot find symbol

symbol: method charAt(int)
location: class Object

how to fix this problem?
I would like to delete the node in list1 which starts with (“).

  • 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-14T15:55:15+00:00Added an answer on June 14, 2026 at 3:55 pm
    1. startsWith is a method in the String class; you are using the raw LinkedList type, and thus it is treated like a LinkedList<Object>. If you wish to use Strings, make it a LinkedList<String>.
    2. startsWith accepts only String arguments, not char arguments. Use startsWith("\"") instead.
    3. The second parameter you’ve supplied to startsWith is superfluous; providing no second parameter will assume starting position as 0.
    4. You have an extraneous semicolon after your if statement. This will cause the if body to be treated as empty. Definitely remove this semicolon and optionally use curly braces.

    Your modified solution may look something like this:

    LinkedList<String> list1 = new LinkedList<String>();
    
    // [...] Populate the list accordingly here
    
    for(int i=1; i < list1.count(); i++){
        if (list1.get(i).startsWith("\"")) {
            list1.remove(i);
        }
    }
    

    Additional notes:

    1. Your for loop starts at index 1. Note that this will not remove over the first element. I’m sure if this is your desired behavior.
    2. As you remove elements in the list, the indices of the latter elements in the list will change.

    For example:

    [ "a", "b", "c", "d" ]
       ^
    (remove element at index 0)
    
    [ "b", "c", "d" ]
            ^
    (remove element at index 1... uh oh, we missed "b"!)
    
    [ "b", "d" ]
                  ^
    (remove element at index 2... ERROR; index out of bounds)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to group user defined variables and get all variable names and
I'm dealing with a COM port application and we have a defined variable-length packet
I'm creating a new block and I want to pass a defined variable to
I have to extract defined variable and function names from a js code passed
How to use the user defined variable in a way that the value of
What is the difference between cfproperty tag defined variable and the variables scope variable
I want to defined a variable/parameter in CSS and access it by javascript. What
I have defined a variable with an own type, say Dim point As DataPoint
How to defined a variable in Javascript, if its not defined. I tried: var
I have this variable defined in my web.config file : <appSettings> <add key =version

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.