I have been building Minecraft Ubuntu servers for our children for a few years. I started a Neoforge modded server. I started to learn how to build custom mods and plugins. I will start with several Udemy.com courses on Java, Spigot, Maven and Minecraft.
I have learned many languages. Check out the programming page.
First Udemy module I took covered basic Java commands. It discussed primitives and non-primitives.
Double in Java is what Float is in C#. Double is 64-bit with 15 decimal places. Float is 32-bit with 7 decimal places
package com.michael.test;
// class is a page
public class Main {
// public static void is like a paragraph
public static void main(String[] args) {
// Non-Primtitive
System.out.println("This is a test");
Integer number2 = 2;
Double double2 = 2.2;
Boolean boolean2 = false;
Character character = 'D';
// Primitive
int number = 5;
double decimalNumber = 102.5;
boolean trueFalse = true;
char letter = 's';
System.out.println(letter);
printMessage("Test message from other method");
int result = printMessageInt("result");
System.out.println(result);
// sout is the short cut
}
private static void printMessage(String message) {
System.out.println(message);
}
private static int printMessageInt(String message) {
System.out.println(message);
return 12;
}
}
This is a test
s
Test message from other method
result
12
The second Udemy module covered Try Catch and
Main2.java
package com.michael.test;
public class Main2 {
public SecondClass secondClass;
public static void main(String[] args) {
String string = "";
//gets number 6 from here
SecondClass secondClass = new SecondClass(6);
secondClass.bbbbbb();
secondClass.cccccc();
}
}
secondClass
package com.michael.test;
public class SecondClass {
// Constructor
public SecondClass(int number) {
System.out.println("Second Class has been recreated");
// get number from main2
System.out.println(number);
aaaaaa();
}
private void aaaaaa() {
System.out.println("A new private method has been created in SecondClass");
}
public void bbbbbb() {
System.out.println("A public method is accessible in main2");
}
protected void cccccc() {
System.out.println("A only accessible in the folder in main2");
}
}
Output
Second Class has been recreated
6
A new private method has been created in SecondClass
A public method is accessible in main2
A only accessible in the folder in main2
Process finished with exit code 0