Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about invariance

Read more about invariance

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - invariance

Is it possible to have an interface for Java arrays?

Let's say we want to have a method in an interface that returns an array, like this: interface A { B[] findAllB(); } But arrays are very low-level and implemented definitively. Their implementati...
test-img

SMMH

java

arrays

list

covariance

invariance

Votes: 0

Answers: 5

Latest Answer

You could do it like this. Specify the array as the type parameter when implementing the interface. interface A<T> { T findAllB(); } class Tryit implements A<int[]> { int[] test ...
test-img

WJS

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved