Home > Back-end >  JAVA problem, a great god give directions!
JAVA problem, a great god give directions!

Time:10-25

Next is self-study JAVA, is the following case of problem, strives for the great god give directions!

This is a new object in another project,

Package has been imported,

This is the mistake,

I don't know what is this problem, a great god give directions!
By the way, I were followed online video, video, the teacher taught not to write generic!

CodePudding user response:

The? To the Object

CodePudding user response:

reference 1st floor m0_46219068 response:
? To Object

Should not the problem, the teacher use the question mark in the video

CodePudding user response:

See prompt, always infer type arguments for DefaultCommunicatorImpl<> , this is the custom of a generic class, you are not the JDK's own, so I can't infer & lt;> The inside of the generics, you instantiate DefaultCommunicatorImpl class to write full
 DefaultCommunicatorImpl Comm=new DefaultCommunicatorImpl<> (a); 

Change
 DefaultCommunicatorImpl Comm=new DefaultCommunicatorImpl (a); 
  • Related