When it comes to return values, widening is dangerous, so the compiler doesn't allow it. Imagine your code does compile, and then you write this: B b = new C(); String str = b.execute(); The first line is fine - we're assigning a subtype of B to a variable of type B. We'd expect the second line to work - B.execute() ...
Greetings all! I have a puzzling issue on how to properly design some relatively simple objects. Lets say I start out with a simple data object, whose members are also other data objects. (In the examples below, the IOrderDetail and IOrder are interfaces that define getter setter signatures) public class OrderDetail implements IOrderDetail { private String itemDescription = null; private String ...
Hi All, Perhaps this is a silly question, but here goes: I'm working with a class (let's call it Class C) from a library that I'm importing in. C has many variables that are public, but there's one that's private in there (Widget W). My issue is that Widget W is initialized in a certain way that I'm not fond of, ...
oh my god LOL ...gosh the main problem is in the first post. I've a extended class FileIO that reads from the txt file the number of lines. and keep that string ( with the number e.g 28 ) inside the method lerLinhaN and returns....then i want to catch that string with the nrLines() of the super class , cast the ...