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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:30:01+00:00 2026-06-07T13:30:01+00:00

I cant figure out how the int 7 is consider as object in below

  • 0

I cant figure out how the int 7 is consider as object in below example.

The sifer(7) is consider to be method sifer(Object o). I am not able to get it how this happened. In one of my java reference book it says Int can be boxed to an Integer and then “widened” to an object. I am not sure what that means.

 >> Class A 
class A { }     

 >> Class B 

class B extends A { }   
 >> Class ComingThru  

public class ComingThru {  
   static String s ="-";    
static void sifer(A[] ...a2)  
{  
    s = s + "1";  
}

static void sifer(B[] b1)  
{
    s += "3";  
}
static void sifer(Object o)   
{
    s += "4";  
}      

   public static void main(String[] args)   {
        // TODO Auto-generated method stub

    A[] aa= new A[2];  
    B[] ba = new B[2];  

    //sifer(aa);  
    //sifer(ba);  
    sifer(7);
    System.out.println(s);  


}  

}

  • 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-07T13:30:03+00:00Added an answer on June 7, 2026 at 1:30 pm

    Since there is no sifer(int) method, the compiler will try to find the “closest match”. In this case, the other 2 sifer methods take arrays as parameters, which an int clearly isn’t.

    The last method, sifer(Object) can be applied to any objects, including an Integer so that’s the method that is used for sifer(7).

    The reality is a little more complex, and the JVM will look for a matching mathod in the following order:

    • an identity conversion
      • in your case: sifer(int) but there is no such method
    • a widening primitive conversion
      • in your case: sifer(long) for example, but there is no such method
    • a widening reference conversion
      • in your case: not applicable, int is not an object
    • a boxing conversion optionally followed by widening reference conversion
      • in your case that’s what’s happening: int is boxed to Integer which is widened to Object
    • an unboxing conversion optionally followed by a widening primitive conversion
      • in your case: not applicable
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't figure out the problem in this: #include<stdio.h> int main() { int a,b,count
I cant figure out how to get lua to do any common timing tricks,
I want to do something but cant figure out how to do this (i
I am getting segmentation fault in this code but i cant figure out why.
This seems in my head like it should work but I cant figure out
I cant really figure out whats wrong with this. I used to write the
I cant figure out how to properly pass this double pointer.... nothing i've tried
I cant figure out how to start a method to delete a specific entry
I am getting desperate here. I cant figure out why does this exception occur.
Im having a odd Problem with the TTS engine and I cant figure out

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.