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 8212227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:41:03+00:00 2026-06-07T10:41:03+00:00

So how can I do the following in Java? List<String> strings = new ArrayList<String>();

  • 0

So how can I do the following in Java?

List<String> strings = new ArrayList<String>();       
JAXBElement<List<String>> jax = new JAXBElement<List<String>>(new QName("strings"), List<String>.class, strings);

The issue specifically occurs at List.class and the error returned is:

Multiple markers at this line
- List cannot be resolved to a variable
- String cannot be resolved to a variable
- Syntax error on token ">", void expected after this token
  • 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-07T10:41:05+00:00Added an answer on June 7, 2026 at 10:41 am

    You can’t.

    The closest approximation to what you want is to use (Class<List<String>>) List.class.

    This is because there is no List<String>.class, because at runtime, List<String>, List<Banana>, List<FruitSalad>, and List are all the same in Java. This is deliberately done for a whole bunch o’ reasons, and it’s called type erasure.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please have a look at following code : import java.util.ArrayList; import java.util.List; class Main{
Take the following generics example import java.util.List; import java.util.ArrayList; public class GenericsTest { private
I can't figure this out. I have the following code: import java.util.ArrayList; import java.util.List;
Consider the following program: import java.util.List; import java.util.ArrayList; public class TypeTest { public static
import java.util.*; public class PossibilityGame { private List<String> list1, list2, list3, list4; public PossibilityGame()
I have a TreeMap that holds the following keys/values: private ArrayList<TreeMap<String,String>> mList = new
I have the following code for sorting. Can this be improved? import java.util.*; class
Consider the following simple code import java.util.*; public class MainTest<T extends Object1<?,?>> { List<T>
Can you do the following with a Java ResourceBundle? In the properties file... example.dynamicresource=You
For stand-alone java application I can use the following codes to load jar lib

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.