Skip to content

Instantly share code, notes, and snippets.

@LemonSpike
Last active April 30, 2021 19:10
Show Gist options
  • Save LemonSpike/24a1cca5e919aee02c52219cf74edcc6 to your computer and use it in GitHub Desktop.
Save LemonSpike/24a1cca5e919aee02c52219cf74edcc6 to your computer and use it in GitHub Desktop.
Running Java in Xcode.. don't ask me why 🤷‍♂️. Taken from: https://discussions.apple.com/docs/DOC-5161.
import UIKit
// 🤔
class ChangeConstants {
private final int[] orderedCoinLabels = { FIFTY_POUNDS_VALUE,
TWENTY_POUNDS_VALUE,
TEN_POUNDS_VALUE,
FIVE_POUNDS_VALUE,
TWO_POUNDS_VALUE,
ONE_POUND_VALUE,
FIFTY_PENCE_VALUE,
TWENTY_PENCE_VALUE,
TEN_PENCE_VALUE,
FIVE_PENCE_VALUE,
TWO_PENCE_VALUE,
PENCE_VALUE
};
}
public class HelloWorld
{
public static void main(String[] args)
{
int label = orderedCoinLabels[0];
System.out.println("Hello, this is my label number: " + label);
}
}
# A simple makefile for a Hello World Java program
# Define a makefile variable for the java compiler
JCC = javac
# Define a makefile variable for compilation flags
# The -g flag compiles with debugging information
JFLAGS = -g
# typing 'make' will invoke the first target entry in the makefile
# (the default one in this case)
default: $(subst .java,.class,$(wildcard *.java))
# this target entry builds the Average class
# the Average.class file is dependent on the Average.java file
# and the rule associated with this entry gives the command to create it
#
%.class : %.java
$(JCC) $(JFLAGS) $<
# To start over from scratch, type 'make clean'.
# Removes all .class files, so that the next make rebuilds them
#
clean:
$(RM) *.class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment