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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:45:27+00:00 2026-06-06T22:45:27+00:00

I am currently writing a program using Weka that builds a model (using one

  • 0

I am currently writing a program using Weka that builds a model (using one of the various model types included in Weka). The part I’m having trouble with is that I want to allow the program to use multiple types for the same function. For example, if I choose to use a J48 decision tree, I need to build and call functions on a variable of type J48. On the other hand, if I want to use a BayesNet I need to build and call the same functions on a variable of type BayesNet. This model needs to be used at different points of the program, and so a simple if-else chain won’t do.

Essentially what I need is the equivalent of a void pointer in C++. Something that can take on various types that can all perform a similar function. I’m tried using the generic Object class but found it was not able to be casted to the correct type (I got “incompatible type” errors).

So, the short version of my question is this: How do Java programmers solve the problem that C++ programmers would solve with void pointers?

Thanks,
-Morag

  • 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-06T22:45:28+00:00Added an answer on June 6, 2026 at 10:45 pm

    Do you mean, something like this?

    public void doStuff(MyType<?> someObject) { }  
    

    ? stands for any type and represents unbounded wildcard.

    Just beware, that this wildcard has certain limitations. For example, you can’t add anything to List<?>.

    See Official Tutorial or AngelikaLanger Generics FAQ for more information.

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

Sidebar

Related Questions

I am writing a program that generates excel reports, currently using the Microsoft.Interop.Excel reference.
I'm currently writing myself a little C# back up program. I'm using a standard
I'm currently writing a java program that requires some Data to run. The data
Backgorund I am currently writing a program that allows a user to select a
I'm writing a Linux program that currently compiles and works fine on x86 and
I am writing a program using threads in c++ in linux. Currently, I am
I am currently writing an open source SDK for a program that I use
I am currently writing a program which is having a lot of code duplication
I'm writing a program that, using Rijndael, will encrypt and decrypt files/folders using a
I am currently writing a non-web program using mostly python and have gotten to

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.