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 (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
3
votes
Adventure game player using public fields instead of getters and setters
This is not something recommended by most of the programmers out there.
If you know you are doing something breaking a rule and have a really good reason to do it, I see no shame in doing it. But yo …
1
vote
Manipulating strings and character positions
In your countOccurences method, you don't need 2 variables:
public static int countOccurrences(String s, char c) {
int nbOccurence = 0
for(int i = 0; i <= s.length()-1; i++){
if(s.cha …
0
votes
Check for Palindrome string in Java
edit: Ok I am no Java specialist but the code could be something like
int a = 0;
int b = userInput.length()-1;
while (a<=b && userInput.charAt(a) == userInput.charAt(b)){
a++;
b--;
}
if (a>= …