public class Balita{ public static void main(String []args){ int umur; umur= 4; if(umur < 5) System.out.println("BALITA"); } }
public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); } }
public class HelloWorld{ public static String lcs(String str1, String str2){ int l1 = str1.length(); int l2 = str2.length(); int[][] arr = new int[l1 + 1][l2 + 1]; int len = 0, pos = -1; for (int x = 1; x < l1 + 1; x++){ for (int y = 1; y < l2 + 1; y++){ if (str1.charAt(x - 1) == str2.charAt(y - 1)){ arr[x][y] = arr[x - 1][y - 1] + 1; if (arr[x][y] > len){ len = arr[x][y]; pos = x; } } else arr[x][y] = 0; } } return str1.substring(pos - len, pos); } public static void main(String[] args){ String str1="abcdefghijklmnopqrstuvwxyz"; String str2="randomijklmnstring"; String result = lcs(str1, str2); System.out.println("\nLongest Common Substring : "+ result); } }
public class Suma{ public static void main(String []args){ int wynik = 0; for (int i = 0; i <= 9; i++){ wynik = wynik + i; } System.out.print("Wynik to: " + wynik); } }
public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); } }
public class HelloWorld{ public static void main(String []args){ System.out.println("Hello World"); } }
public class UniqueTest { public static void main( String args[]) { Unique application = new Unique(); application.getNumbers(); } }
public class HelloWorld { public static void main(String []args) { Dog myDog = new Dog("rover"); myDog.age = 3; Cat myCat = new Cat("kitty", 3); myCat.age = 1; // Change the age field from 3 to 1. myDog.licensed = true; myCat.isPersian = true; myDog.bark(); myCat.meow(); System.out.println("My Dog " + myDog.name + " is " + myDog.age + " years old"); System.out.println("My Cat " + myCat.name + " is " + myCat.age + " years old"); Animal myAnimal = new Animal("roger"); myAnimal.age = 5; myAnimal.bark(); // Fails since bark is not part of Animal. // Comment out to compile. PrintAnimal(myDog); PrintAnimal(myCat); PrintAnimal(myAnimal); } public static void PrintAnimal(Animal animal) { System.out.println("My " + animal.getClass().getName() + " " + animal.name + " is " + animal.age + " years old"); } public static class Animal { public String name; public int age; public Animal() { } public Animal(String name) { this.name = name; } } public static class Cat extends Animal { public boolean isPersian; public Cat(String name, int age) { super(name); super.age = age; // Access superclass field. } public void meow() { System.out.println(super.name + " says MEOW!"); } } public static class Dog extends Animal { public boolean licensed; public Dog(String name) { super(name); // Invoke superclass constructor. } public void bark() { System.out.println(super.name + " says BARK!"); } } }
import java.util.Scanner; import java.util.ArrayList; public class Test{ private static Scanner sc = new Scanner(System.in); private static String ans; public static void main(String []args){ } private static void Print(String a){ System.out.println(a); } public static void AIController(){ } } class Player{ private int StartingX; private int StartingY; private ArrayList x = new ArrayList<Integer>(); private ArrayList y = new ArrayList<Integer>(); private ArrayList Responses = new ArrayList<String>(); private ArrayList Inventory = new ArrayList<Item>(); public Player(int a, int b){ x.add(a); y.add(b); StartingX = a; StartingY = b; } private void Print(String a){ System.out.println(a); } } class Item{ private String name; private int data; private int X; private int Y; private double type; private double damage; private long durability; public Item(String n, int d, int x, int y, double t, double dam, long dur){ name = n; data = d; X = x; Y = y; type = t; damage = dam; durability = dur; } }
public class HelloWorld{ public static void main(String []args){ int[][] a= {{1,2,3},{3,4,5},{6,7,8}}; int[][] b= {{1,2,3},{3,4,5},{6,7,8}}; int[][] c= new int[3][3]; for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { c[i][j]=0; for(int k=0;k<3;k++) { c[i][j]=c[i][j]+a[i][k]*b[k][j]; } System.out.print(c[i][j] + " "); } System.out.println(); } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more