As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm just curious. (Maybe not only in Android)
Android's callbacks respond to events. You react to events when they occur. So when an event occurs you do something. Therefore:
onOccurrence() {
doSomething;
}
It's just a convention.
Well, Java programming is designed to be readable, and although at times it does appear bloated, it is still very readable, especially Android. I'm guessing the SDK developers wanted to give names that would be read in a very readable manor.
onPause(){
Do stuff here when app is paused.
}
How more obvious can it get?
As they correspond to "events" and in Android all "event" method start with the "on" prefix. I really didn't like this at the beginning as it's not a java convention, but, after all, why not.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am looking for a website where I could practice Java coding assignments that you often get on job interviews. I mean those tasks where you need to calculate primitive numbers, implement some sorting, or do something with an Array, List or a Map. I'm quite experienced java developer, but such tasks can sometimes be tricky :)
Do you know any free websites that could help?
Thanks.
Go to interviewstreet. Companies often use it as first technical screen
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am reading OOPS concepts and got stuck on Abstraction. I am not able to fully understand the concept. As I am feeling that it doesn't belongs to OOPS only. It was also used in C. But how
java abstraction different from C language abstraction. I know it is not a good question
for this forum but i am not able to get the perfect answer.
abstraction means to hide or to separate the complex details of one part of code to other part. say, you have to use a method that does complex calculation, and gives some result. So instead of writing your method inline, its better to write it in a method that just expose the signature (params and return type). in that way your caller (of method) remains unaware of complex code behind the method.
in general, when you use library function in c/c++ or APIs in java, it is also an abstraction.
So indeed, abstraction is not only OOP, but a general concept can be applied anywhere (even beyond the programming).
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been programing for about a year now, and have a very good grasp on all the basic of programming in generaly and am a pretty decent Java programmer, so now that I have the time I would like to start making games in Java. However, Id really like to not use any extra librarries, and just use pure Java for the first little bit until I fully understand the machanics of a video game.
I have been looking around the internet and have seen more "best ways" to do this than I can count. So if somebody could point me in the right direction that would be great! (As in send me to the best, easiest to follow, and most up to date ressource either print or on the web)
It just seems that no matter where I look I get completly diffrent info on the same subjuct. So I would really apreciate if somebody could just give me a resource that follows whatever the current standard is.
P.s typed on my phone so sorry for any typos :-)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I heard one of my colleagues saying that Java handles recursion more efficiently than c or C++, I was just curious what why is it able to do so? I mean what is "under the hood" process that makes this happen.
All efforts appreciated.
The usual issue around recursion (not 100% sure this is what your colleague was referring to) is whether 'it' (the compiler, the JIT, the runtime, whatever) can (and does) implement 'tail call optimization'. The goal is that instead of having the code make 'real' calls (introducing a new frame onto the call stack) that recurse (either into the same function or through the same 'cycle' of functions), you can get the same effect without doing so.
The wikipedia page is pretty decent on describing it.
http://en.wikipedia.org/wiki/Tail_call
If it's correct it's because the JIT compilation is able to optimize a recursion better than the C compiler. http://en.wikipedia.org/wiki/Just-in-time_compilation
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Can someone list comprehensive list the pros and cons of using regular expressions in Java programing?
Pro: when regular expressions do what you need.
Con: when they don't.
Other than that, the question as stated is mostly ideological.
Pros:
They are an effective way to match against input.
They are easily configurable and can be separated from code.
Cons:
They be hard to read.
They are not performant. If performance is a concern do not use them.
Pro: It works and it's simple.
Con: There are none.
Why ask? Perhaps you have something more specific you'd like to know?