Looking for Objektumorientált programozás test answers and solutions? Browse our comprehensive collection of verified answers for Objektumorientált programozás at moodle.ms.sapientia.ro.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Hogyan érhetünk el egy static metódust kívülről?
Adott a következő osztály. A megadott kódrészletekből válassza ki azokat, amelyek hibamentesen lefutnak.
import java.util.ArrayList;public class Delete { public static void main(String args[]) { ArrayList<String> names = new ArrayList<String>(); names.add("Fulop Peter"); names.add("Biro Emese"); names.add("Kukta Piroska"); names.add("Szanto Zoltan"); names.add("Bodo Barna"); names.add("Egyed Barna"); }}
Mi lesz a kimenet az alábbi kód esetén?
ArrayList<Integer> list = new ArrayList<>();list.add(10);list.add(20);list.add(30);System.out.println(list.get(1));
Mit ír ki a következő program?
public class Main { public static void main(String[] args) { int[] t1 = new int[4]; for (int i = 0; i < t1.length; ++i) { t1[i] = 10; } int[] t2 = new int[2]; for (int i = 0; i < t2.length; ++i) { t2[i] = 20; } t1 = t2; for (int e : t1) { System.out.print(e + ","); } }}
public class JavaApplication { public static void main(String[] args) { int x[] = new int[10]; System.out.print(x[0] + ", " + x[9] + ", "); for (int i = 0; i < x.length; ++i) { x[i] = i; } System.out.println(x[0] + ", " + x[9]); }}
Mi a kimenete a következő programnak?
public class JavaApplication{ public static void main(String[] args) { int x[] = new int[ 10 ]; System.out.print( x.length +", "); x.length = 20; System.out.println( x.length ); }}