Skip to content

Instantly share code, notes, and snippets.

View christmoore's full-sized avatar

Christopher Moore christmoore

View GitHub Profile
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
public static void main(String[] args)
{
//Do something here
}
public class HelloWorld
{
public void HelloWorld()
{
System.out.println("Hello World");
}
public static void main(String[] args)
{
HelloWorld hw = new HelloWorld();
}
int i = 1;
if (i < 2)
{
System.out.println("This is an if statement that works");
}
int i = 4;
if (i < 2)
{
System.out.println("This is an if statement that doesn't works");
}
int x = 2**2;
if(x > 4)
{
System.out.println("Does this work?");
}
int i = 9;
if(i % 2 == 1)
{
System.out.println("Does this work?");
}
int x = 2**2;
if(x > 4)
{
System.out.println("Does this work?");
}
else if(x % 2 == 0)
{
System.out.println("Does this work?");
}
int x = 2**2;
if(x > 4)
{
System.out.println("Does this work?");
}
else if(x % 2 == 1)
{
System.out.println("Does this work?");
}
else
for (int i = 1; i <= 1001; i += 2)
{
System.out.println(i);
}
int i = 1;
while (int i <= 1001)
{
}
int i = 1;
while (int i <= 1001)
{
System.out.println(i);
i+=2;
}