dan1st
dan1st
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
That's perfectly fine as long as you don't make too many assumptions thinking it would work similarly
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
ig that might be what you mean
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
but objects are references to the same object and if you pass that, you get a new reference to the same object
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
If you pass a primitive parameter, it copies the value
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
I know obsidian linking but I don't really see the connection
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
?
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
Why?
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
And parameters in general: If you declare a method like this:
public static void someMethod(){
//...
}
public static void someMethod(){
//...
}
then you can call it with someMethod(); but if you declare a method like this:
public static void someMethod(String someString){
//...
}
public static void someMethod(String someString){
//...
}
then you can call it with someMethod("Hello World"); (or with any other String) and you can use the passed value in the method:
public static void someMethod(String someString){
System.out.println(someString);
}
public static void someMethod(String someString){
System.out.println(someString);
}
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
For main arguments specifically: You can start a program using java YourMainClass.java/java your.fully.qualified.Main/java -jar yourjar.jar. You can also add additional text after that. So you'd start it with java YourMainClass.java your arguments here/java your.fully.qualified.Main your arguments here/java -jar yourjar.jar your arguments here. In this case, args woulöd have the Strings your, arguments and here
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
these are program arguments
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
and then you convert each group to a decimal number and then that decimal number is the hex digit (ofc use ABCDEF for numbers between 10 and 16)
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
you just split it in groups of 4
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
For binary<--> hex conversion specifically, it's easier
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
For converting decimal to hex, you divide it by 16 and take the remainder. That's the last digit. You continue using the result of the division and repeat
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
You can convert a binary number to decimal like this: The leftmost bit is 1, then 2, then 4, then 8, etc - you multiply each bit with the corresponding number and add them up
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
There are a few techniques for it
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
oh you mean without code?
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
String hexadecimal = "A5";//a string with a number in hexadecimal
int convertedToInt = Integer.parseInt(hexadecimal, 16);//convert the hex (16) string to an int for further processing
String toBinary = Integer.parseInt(convertedToInt, 2);//convert the int to a binary (2) string
String toDecimal = Integer.parseInt(convertedToInt, 10);//convert the int to a decimal (10) string
String hexadecimal = "A5";//a string with a number in hexadecimal
int convertedToInt = Integer.parseInt(hexadecimal, 16);//convert the hex (16) string to an int for further processing
String toBinary = Integer.parseInt(convertedToInt, 2);//convert the int to a binary (2) string
String toDecimal = Integer.parseInt(convertedToInt, 10);//convert the int to a decimal (10) string
51 replies
JCHJava Community | Help. Code. Learn.
Created by Piglet | **NEED** tone tags!! on 9/21/2024 in #java-help
prepping for an exam, new to java & might need help understanding some stuff
Well you can still use Integer.parseInt om your cpde
51 replies