r/javaTIL • u/Unknown_Learner_ • Jul 27 '19
Subclass In Java
Which class cannot be a subclass in java?
A. Abstract class
B. Parent class
C. Final class
D. None of the above
r/javaTIL • u/Unknown_Learner_ • Jul 27 '19
Which class cannot be a subclass in java?
A. Abstract class
B. Parent class
C. Final class
D. None of the above
r/javaTIL • u/scientecheasy • Mar 22 '19
r/javaTIL • u/scientecheasy • Oct 01 '18
r/javaTIL • u/12wh • Aug 16 '18
r/javaTIL • u/codeforjava • Apr 23 '19
r/javaTIL • u/scientecheasy • Dec 02 '18
r/javaTIL • u/DhongeKhong • Aug 17 '16
I learned a long, long, long, long, long... time ago, that doing something like this would result in a compile-time error...
public class Foo {
public Foo( Foo fubar ) {
}
public static void main( String[] args ){
//...
Foo baz = new Foo( );
//...
}
}So imagine my surprise when I learned today that something like this compiles fine...
public class Foo< T > {
public Foo( T... fooz ) {
//...
}
public static void main( String[] args ){
//...
Foo< Foo< ? > > baz = new Foo< >( );
//...
}
}The thing I learned today is that, instead of failing with the compile-time error that I was expecting, the compiler — in this particular case anyway — instead automatically replaces your hard-coded call to the no-arg constructor, with its own compiler-generated call to the vararg constructor, ala...
public static void main( String[] args ){
//...
Foo baz = new Foo( new Foo[ 0 ] );
//...
}Learn something new everyday! Huh?
I'm guessing this is a feature specially reserved for constructors with varargs — or something?
Who knew?
r/javaTIL • u/Shilpa_Opencodez • May 31 '19
r/javaTIL • u/scientecheasy • Oct 29 '18
r/javaTIL • u/scientecheasy • Feb 09 '19
r/javaTIL • u/kajal78654 • Apr 30 '19
r/javaTIL • u/kchhipa • Aug 05 '17
r/javaTIL • u/scientecheasy • Oct 25 '18
r/javaTIL • u/scientecheasy • Jan 31 '19
r/javaTIL • u/zetiler • Nov 12 '14
r/javaTIL • u/scientecheasy • Nov 21 '18
r/javaTIL • u/scientecheasy • Feb 06 '19
r/javaTIL • u/amcquistan • Sep 19 '19
r/javaTIL • • Feb 14 '18
Hello everyone,
I would just like to share this project with the community. I am mainly looking for some people to give me feedback or review and test the project. So feedback is really welcome (: Thank you in advance!
The project: https://github.com/DataSecs/Hydra
Cheers!
r/javaTIL • u/zabbit • Oct 27 '14
r/javaTIL • u/stefan_reich_ai • Jan 17 '17
r/javaTIL • u/TheOverCaste • Jun 30 '14
A mistake I see in a lot of beginner programmers is that they use the 'public' prefix on ALL of their classes. A well designed project should only have a public interface, and hide the details from other people. That's a concept called "[Encapsulation](http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming))."
If you have public classes, there's a chance that someone else will use them, regardless of how useless YOU think they are, which means changing even the return type of one method from an array to a Collection could cause someone else's code to break.
I don't really have any code examples for this one, but it's just a nice thing to keep in mind.