You can test basic java code in this browser environment
Type: Posts; User: AngleWyrm
You can test basic java code in this browser environment
Have you played XCOM, where a 95% chance to hit misses a lot more than once in twenty? Or Rimworld, where a hunter fires at long range with a weapon that says 90% chance to hit at long range? Or any...
A good place to share source code is github
AI programmer assistant Github CoPilot provides a substantial improvement to the code completion and error checking present in most IDEs.
This might be a useful addition to forums that field...
Also, the value in set_intensity(255) suggests an 8-bit integer with a range of 256 [0..255], or some larger multiple thereof. But there's also an entry for set_intensity(2000)
If 2000 were a...
This type of mapping from variable to meaning is something inherited from mathematics. Modern programming languages can incorporate that information directly into the name like so
double...
String myString = "my new string";
Creating a class in Java
That's not a setter, that's a getter. You can tell the difference because it takes no inputs and returns an output.
And it's there specifically to prevent you from fiddling with the variable...
public String getMenu()
This line states the return type of the function getMenu is a String.
Example load() function
https://youtu.be/FgakZw6K1QQ
Check out Principal Component Analysis
You haven't taken my advice, so why should I expect even more such advice would be useful?
I do have an opinion: The habitual and pedantic use of single-letter variables is a hold-over from...
rename the variable i to index.
int someInt = 3;
float someFloat = 1.225;
System.out.println(
String.format("Integer value: %s, float value: %f", someInt, someFloat)
);
String formatting codes
final String myImmutableString = "hello";
String ordinaryString = " world";
myImmutableString += ordinaryString;
Java video course https://youtu.be/-C88r0niLQQ
12x40 = 480 words. Since they've been declared as constant, just make them constants.
Constants.java
public class Constants {
public static String[] MY_PHRASES = {
"first phrase",
...
public class ArbitraryClass {
private Integer someValue = 0;
ArbitraryClass(Integer construction_initializer){
someValue = construction_initializer;
}
} // ArbitraryClass
import...
I would create a function compareInts(int A, int B) that returns a string {"less than", "equals", "greater than"}
Then how to generate 60 comparisons would become a separate chore, and entirely up...
https://i.imgur.com/sWkT38M.png
yes it considers each of the three ranges.
If the program falls through all three if statements, then maybe variable vodki = null. But if vodki = null, then if...
Periods, duration, date and time arithmetic in Java 8+
I wrote a solution but was advised against posting complete solutions, as it tends to attract those who want only to pass a test without exercising skill. There's some loss of learning by example,...
Java String.format specifiers