Stephan van Hulst wrote:
Car manufacturers must publish modules that contain the declarations of the methods that can be called, otherwise guidance manufacturers can't develop their software effectively. However, they are not required to publish the modules that implement these methods. They could install these modules right into the cars that they manufacture, even having them protected by the car's hardware. When they don't use interfaces to publish the method declarations, they must include their implementations with the published module, which can then be reverse engineered by the guidance manufacturers.
Stephan van Hulst wrote:
Yes, you could say that. However, usually default method implementations shouldn't be very complex, so I doubt anybody would care about reverse engineering them.
For example, imagine a futuristic society where computer-controlled robotic cars transport passengers through city streets without a human operator. Automobile manufacturers write software (Java, of course) that operates the automobile—stop, start, accelerate, turn left, and so forth. Another industrial group, electronic guidance instrument manufacturers, make computer systems that receive GPS (Global Positioning System) position data and wireless transmission of traffic conditions and use that information to drive the car.
The auto manufacturers must publish an industry-standard interface that spells out in detail what methods can be invoked to make the car move (any car, from any manufacturer). The guidance manufacturers can then write software that invokes the methods described in the interface to command the car. Neither industrial group needs to know how the other group's software is implemented. In fact, each group considers its software highly proprietary and reserves the right to modify it at any time, as long as it continues to adhere to the published interface.\
Knute Snortum wrote:
If you just write Class clazz you get a compiler warning, because the compiler doesn't know what type (generic type) of Class you mean.
Henry Wong wrote:
Second, the type being referred to here is the generic, and not the type of the object... but yes, you are declaring a reference to a Class instance, whose generic can be any type
Henry
Henry Wong wrote:
First of all, you are declaring a reference, and not the object.
Henry Wong wrote:
Wildcards are for the reference only, and not related to the object.
Henry Wong wrote:
Second, the type being referred to here is the generic
paul wheaton wrote:Here is the full and complete reason: there was some disagreement among the staff about what the algorithm should be like. I felt like it is possible to come up with an algorithm that would make everybody on the staff happy, but it would be a pretty rich algorithm. So I locked down all the editing until we can have a great solution. The first step would be that somebody would need to take the time to make a proposal that everybody would be happy with. It would probably be default settings for the whole site, with some fine tuning by certain forums, and further fine tuning by thread or post or user.
That was over a year ago.
So far, nobody has made a proposal.
Ron McLeod wrote:You had an extra [quote] tag in your post - I removed it for you.
Norm Radder wrote:
You need to study about classes and methods. See the tutorial:
Norm Radder wrote:
You need a reference to an instance of the class to be able to call its methods:
Where does your code have a reference to an instance of the Package class so that it can call its getPackage method?
I am so much confused regarding how to use in-built methods and packages. May be I didn't gave this a thought recently! I can understand that you may need the instance of the class to call its method. But, if I create an instance of the Package class, I will get the package name of that class, whereas I want to know the package name of my current class ie Hello. I may be getting you wrong, but if what you say is true, then no one will be able to use these in-built methods for their own purpose.
Norm Radder wrote:
You need to look at the API doc for the class that method is in to see how to use it.
Norm Radder wrote: Hello.getPackage()
is the syntax for calling the static method in the class Hello. The compiler gives an error message because it can not find that method.
Norm Radder wrote:
Sorry I do not see it shown in your post. I was looking for something like this: A command-line that executes the java command with Hello
C:\MyFolder\>java Hello
showing the java command with one argument: Hello