Erinevus lehekülje "ITI0011:Kordamine eksamiks" redaktsioonide vahel

Allikas: Kursused
Mine navigeerimisribale Mine otsikasti
(Uus lehekülg: '== Koodilugemine == <source> public class First { public static int a = 5; public static int x = 10; public static void main(String[] args) { a = x; x++; int aa = a; ...')
 
1. rida: 1. rida:
 
== Koodilugemine ==
 
== Koodilugemine ==
  
<source>
+
<pre>
 
public class First {
 
public class First {
  
50. rida: 50. rida:
 
}
 
}
 
}
 
}
</source>
+
</pre>

Redaktsioon: 18. detsember 2014, kell 10:14

Koodilugemine

public class First {

	public static int a = 5;
	public static int x = 10;
	public static void main(String[] args) {
		a = x;
		x++;
		int aa = a;
		int y = x() + a(x) + x(x(aa));
		System.out.println("main a:" + a + " x:" + x);
		System.out.println("y:" + y);
		
		int a = 2 * 4;
		for (int i = a; i - 2 > 5 / 2; ) {
			System.out.println(i);
			a += i--;
		}
		System.out.println("a:" + a);
		
		String s = "taskuuni";
		String result = "";
		for (a = 2; a < 4; a += 1) {
			result = s.substring(a, 2 * a) + result;
		}
		System.out.println(result);
		System.out.println(s.charAt(2) + result.substring(1));
	}
	
	public static int x() {
		return a + 1;
	}
	
	public static int a(int a) {
		//a = a++ + 1;
		a = a + 2;
		System.out.println(a);
		for (int x = 0; a < 1; a++) ;
		System.out.println("a a:" + a + " x:" + x);
		return 0;
	}
	
	public static int x(int x) {
		x++;
		a--;
		System.out.println("x a:" + a + " x:" + x);
		return x;
	}
}