Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.
17
votes
How can I be certain that my code is flawless?
You cannot establish correctness via testing. All that tests tell you is that the system responds correctly to the cases you exercised. (Even if there is a finite number of possible inputs, that is no …
3
votes
Accepted
Automatic Type Promotion in JAVA
(There is a hint in the specification, that says the result of the binary operation is converted to the type of the left-hand variable, Java Specification 1.7) There is no such rule defined for assignment …
1
vote
DataThread class that doesn't extend Thread, poor naming?
It's not true.
The name of a class is part of its public interface. The user of a public interface doesn't care how functionality is implemented, only that it is available. (Indeed, allowing the user …
9
votes
Accepted
Encapsulation and information hiding in Java
Because information hiding is not a security measure.
It's a human-oriented measure for improving understanding.
The point of making a field private is not to prevent it from being changed. If an at …
7
votes
Accepted
Post Increment of a variable in brackets
You're confusing two different rule sets that deal with ordering things.
Operator precedence determines which operator in a complex expression is evaluated before the other. Multiplication takes prec …
9
votes
What is the difference between polymorphism and instanceof?
The defining criterion of polymorphic behaviour differences between classes is that the alternating behaviour is programmed within each class and not into any user of these classes.
In your case, this …
3
votes
How to manage exceptions in a long call stack
The fact that Java forces you to declare some Exceptions ("checked" exceptions) in the header of every method that might raise them and that this somewhat obfuscates your code is a Java-specific issue …
2
votes
Synchronization in the given Code
They were probably talking about access control and the somewhat surprising fact that private means "private to all instances of the class" and not "private to to the owning instance only" in java. object2 …
4
votes
Java class to enforce an implementation of super classes' public methods
Once an method has been given an implementation, there is no way of making it abstract again. So, no, without changing A there is no way of writing a class B extends A so that all subclasses of B must …
2
votes
Duck typing in statically-typed languages
But in Java, all class members are fully defined when an object is constructed (in fact, at run-time there is no such thing as an undefined value), so comparing Java objects to those in duck-typed languages …
8
votes
Do I have to write a lot of boilerplate code if I keep working using Java?
We are talking about quite different things here. Replacing boilerplate code with a completely different way of doing things, such as reflection, can be hairy. There can indeed be very good reasons ag …
4
votes
Asserting in public methods
In my opinion the visibility of your methods doesn't matter at all. After all, all your private methods are ultimately called from public methods in every case, or they wouldn't be needed!
To be sur …
6
votes
Does the use of debuggers have an effect on the efficiency of programmers?
Using the debugger undoubtedly increases your efficiency, since it allows you to do things that would be difficult or impossible to do without it. It is way more efficient to eval expressions on the f …
6
votes
Would md5 hashes allow detection of synced files?
Yes, MD5 is almost guaranteed to detect any change in files you produce. Collision attacks (methods to create different files with identical hash sums) are possible, but that is only a concern when yo …
1
vote
Design Hash table with simple hash function
Using ASCII codes of a string is actually not a bad method of hashing a value.
Individual letters are not equally common - e is more common than g, and g is much more common than x, so the buckets w …