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.awt.*; | |
| import java.util.*; | |
| import java.awt.event.*; | |
| import javax.swing.*; | |
| import java.awt.geom.*; | |
| public class Turtle { | |
| // ---------------------------------- |
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 Drawing1 { | |
| public static void main(String[] args) { | |
| Turtle.setSpeed(1000); | |
| y(10); | |
| } | |
| static void x(int n) { | |
| if (n == 0) { |
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 Limited { | |
| public static void main(String[] args) { | |
| foo(0); | |
| } | |
| static int foo(int count) { | |
| count = count + 1; | |
| System.out.println(count); |
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 Counter { | |
| public static void main(String[] args) { | |
| foo(0); | |
| } | |
| static int foo(int count) { | |
| count = count + 1; | |
| System.out.println(count); |
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 Overflow { | |
| public static void main(String[] args) { | |
| foo(); | |
| } | |
| static void foo() { | |
| foo(); | |
| } | |
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 Stuff { | |
| public static void main(String[] args) { | |
| String text = "más letras"; | |
| int[] counts = new int[26]; | |
| for (int z=0; z<26; z++) { | |
| for (int q=0; q<text.length(); q++) { |
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 Sorting { | |
| public static void main(String[] args) { | |
| int[] array = { 8, 7, 6, 5, 4, 3, 2, 1 }; | |
| for (int i=1; i<array.length; i++) { | |
| int j = i; | |
| int a = array[i]; | |
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 Pattern { | |
| public static void main(String[] args) { | |
| int width = 150; | |
| int height = 70; | |
| int[][] grid = new int[width][height]; | |
| grid[width/2][0] = 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 Cells { | |
| public static void main(String[] args) { | |
| int[] data = { 0, 1, 1, 0, 1, 0 }; | |
| System.out.println(java.util.Arrays.toString(data)); | |
| int[] data2 = new int[data.length]; | |
| for (int i=0; i<data.length; i++) { | |
| if (data[i] == 1) { | |
| data2[i] = 0; |
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 reverseagain { | |
| public static void main(String[] args){ | |
| int[] data = {1, 2, 3, 4, 5}; | |
| System.out.println(java.util.Arrays.toString(data)); | |
| int[] newData = new int[data.length]; | |
| System.out.println(java.util.Arrays.toString(newData)); | |
| for(int i=0; i<data.length; i++){ | |
| newData[i] = data[data.length - i -1]; |