This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.Math; | |
/* | |
Program that shows in terminal a random number between 1 and 1000 | |
*/ | |
public class RandomNumber { | |
public static void main(String[] args) { | |
int randomnumber = (int)(Math.random()*1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.*; | |
/* | |
Program that shows in terminal today's date | |
*/ | |
public class Today { | |
public static void main(String[] args) { | |
LocalDate today = LocalDate.now(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.TimeUnit; | |
import java.util.Date; | |
import java.lang.Math; | |
/** | |
Program that runs a method for 3 seconds and calculates the time spent doing that execution | |
*/ | |
public class ExecutionTime { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.TimeUnit; | |
/** | |
Program that shows my Full Name ... prints First name, pauses 2 seconds then prints Last name | |
*/ | |
public class FullName { | |
public static void main(String[] args) { | |
String firstname = "Pedro"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NewHumanBeing { | |
public static class Head { | |
//Constructor | |
public Head(){ | |
System.out.println("Creating a Head object"); | |
} | |
public void move(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HumanBeing { | |
public static class Head { | |
//Constructor | |
public Head(){ | |
System.out.println("Creating a Head object"); | |
} | |
public void move(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Head { | |
String eyecolor; | |
String nosetype; | |
boolean moustache; | |
Head (String eyes, String nose, boolean mouthhair){ | |
eyecolor = eyes; | |
nosetype = nose; | |
moustache = mouthhair; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SumIsThirty { | |
public static void main(String[] args) { | |
//Define & Initialization | |
int numbers[] = new int[] {10,333,10,6,10,8,14,43}; | |
int sum = 0; | |
boolean isThirty = false; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ArrayMinAndMax { | |
public static void main(String[] args) { | |
//Define & Initialization | |
int numbers[] = new int[] {1,333,17,6,47,8,14,43}; | |
int min = numbers[0]; | |
int max = numbers[0]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CheckExistence { | |
public static void main(String[] args) { | |
//Define & Initialization | |
int numbers[] = new int[] {1,333,17,6,47,8,14,43}; | |
int numbertocheck = 2; | |
boolean exists = false; | |
NewerOlder