I’m pretty new to Java and I’m finishing my first project using it. Basically I read Head First Java and the API documentation for the classes I’ve used so far. That’s my Java background.
This little piece of code rose a big little doubt on me, basically, what does this statement mean?
DataSource dataSource = new FileDataSource(tiffFile) {
public String getContentType() {
return "image/tiff";
}
};
Is it like a “live method override”? I still don’t get what those brackets are doing there.
I’d really appreciate your help on this one.
Cheers.
What you’ve run across is an Anonymous Inner Class. There are many kinds of nested classes in Java and it would be beneficial for you to be familiar with all of them. I am including a link to a tutorial as a good starting point. Good luck!
Nested Classes in Java