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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:04:22+00:00 2026-06-11T20:04:22+00:00

I am currently working on a project using Objectdb and Im using NetBeans. I

  • 0

I am currently working on a project using Objectdb and Im using NetBeans.
I want to have a myString method that can appear this message :
Variable type is int.
when im calling the object Driver from another main class
[

 import javax.persistence.*;
 import java.util.*;
 //import javax.jdo.*;
 import java.sql.*;

 public class Main { 

public static void Element(Object obj){
    System.out.println(obj);
}//end method Element

 public static void main(String[] args) {

 Element(Driver);

}//end main

]
Of course I don’t want to type exactly this thing so I can print it,
but instead I want a method that can return int if its an integer, String if it is String etc.
When it come to a String variable it is ok.
But when I have an integer it shows me the message “int cannot be dereferenced” so the compiler won’t pass this.

Is this a way to work it around correctly?
This is importart so thanks in advance.

import javax.persistence.*;
import java.util.*;

@Entity
public class Driver{    

@Id 
    private int Driverid;

    public void setDriverid(int Driverid) {
        this.Driverid= Driverid;
    }

    public int getDriverid() {
        return Driverid;
    }

public Driver(int getDriverid){
        this.Driverid=Driverid; 
}

public String toString() {
        return  "Variable type is " + Driverid.getClass.getSimpleName() + "." ;
}//end toString

}//end class Driver
  • 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-11T20:04:23+00:00Added an answer on June 11, 2026 at 8:04 pm

    Try with using the Integer class instead of int. int is a primitive type, Integer is not.

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

Sidebar

Related Questions

I'm currently working on a project using netbeans 6.9 and grails 1.3. I'm trying
I am currently working on a project that is using Dojo as the js
I'm working on a project that is currently using the Zend Framework 1.7.6, however
I am currently working on a project that uses CoreData and relations are using
I am currently working on a project that hosts WinForms designer. I am using
I currently have pagination working in my MVC 3 project using the PagedList library
Currently I'm working on a project using Zend framework and the message notification dialog
I am currently working on a project using the Express framework. I have a
I'm currently working on a project that's using the Dropkick.js plugin to style select
I'm currently working on a Android+AppEngine project using voice as my main input method.

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.