This file contains hidden or 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.*; | |
| import java.io.*; | |
| public class Strings { | |
| public static void main(String [] args) { | |
| Scanner input = new Scanner(System.in); | |
| try { | |
| input.nextInt(); | |
| System.out.println("Thanks"); | |
| } catch (InputMismatchException e) { | 
  
    
      This file contains hidden or 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.io.*; | |
| import java.util.*; | |
| public class NumbersInFile { | |
| public static void main(String[] args) throws IOException { | |
| // | |
| // READING FROM A FILE | |
| // | |
| try { | 
  
    
      This file contains hidden or 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.io.*; | |
| import java.util.Scanner; | |
| public class ReadFile { | |
| public static void main(String[] args) throws IOException { | |
| Scanner input = new Scanner(System.in); | |
| Scanner file = new Scanner(new File("info.txt")); | |
| int numLines = file.nextInt(); | 
  
    
      This file contains hidden or 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
    
  
  
    
  | // Reference for this Class: | |
| // http://www.ntu.edu.sg/home/ehchua/programming/java/images/ExerciseOOP_Circle.png | |
| // | |
| public class Circle { | |
| private double radius; | |
| private String color; | |
| public Circle() { | 
  
    
      This file contains hidden or 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 Puppy { | |
| // Instance Variables | |
| int age; | |
| String color; | |
| String breed; | |
| double weight; | |
| String name; | |
| public Puppy() { | |
| name = "Default"; | 
  
    
      This file contains hidden or 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 static int binarySearch(int numbers[], int key) { | |
| // Select highest and lowest indexes on the array | |
| int mid; | |
| int low = 0; | |
| int high = numbers.length - 1; | |
| // Continue searching while low is still smaller than high | |
| while (low <= high) { | |
| mid = (low + high) / 2; // Binary partition | |
| if (numbers[mid] > key) { | 
  
    
      This file contains hidden or 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 static int search(int[] numbers, int key) { | |
| for (int index = 0; index < numbers.length; index++) { | |
| if (numbers[index] == key) | |
| return index; // Founds the elemnt and finishes the search | |
| } | |
| // If we get to the end of the loop, a value has not yet | |
| // been returned. We did not find the key in this array. | |
| return -1; | |
| } | 
  
    
      This file contains hidden or 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 Partial1CSII { | |
| public static void main(String[] args) { | |
| // Calling exercise II | |
| System.out.println(lowest(4,3,-45)); | |
| // Calling exercise III | |
| int[] numbers = new int[]{4, 20, 35, 4, 6}; | |
| System.out.println(diff(numbers)); | 
  
    
      This file contains hidden or 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.Scanner; | |
| public class ArraysBasics { | |
| public static void main(String [] args) { | |
| Scanner input = new Scanner(System.in); | |
| int meanAge = 0, i; | |
| // Initialization of the two arrays depending on user input | |
| int positions = input.nextInt(); | |
| int[] myArray = new int[positions]; | 
  
    
      This file contains hidden or 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.Scanner; | |
| public class Fibonacci { | |
| public static void main (String [] args) { | |
| Scanner input = new Scanner(System.in); | |
| // Asks for the first number | |
| int num = input.nextInt(); | 
NewerOlder