JAVA BASICS NEW EDITION Online Test

What are the Main OOP concepts?


What is Encapsulation?


What is Inheritance?


What is Polymorphisam?


What means Abstraction ?


class SC2

{

public static void main(String [] args)

{

SC2 s = new SC2();

s.start();

}

void start()

{

int a = 3;

int b = 4;

System.out.print(" " + 7 + 2 + " ");

System.out.print(a + b);

System.out.print(" " + a + b + " ");

System.out.print(foo() + a + b + " ");

System.out.println(a + b + foo());

}

String foo()

{

return "foo";

}

}


class BoolArray

{

boolean [] b = new boolean[3];

int count = 0;

void set(boolean [] x, int i)

{

x[i] = true;

++count;

}

public static void main(String [] args)

{

BoolArray ba = new BoolArray();

ba.set(ba.b, 0);

ba.set(ba.b, 2);

ba.test();

}

void test()

{

if ( b[0] && b[1] | b[2] )

count++;

if ( b[1] && b[(++count - 2)] )

count += 7;

System.out.println("count = " + count);

}

}


Which two statements are equivalent?

3/2

3<2

3*4

3<<2


public class Test

{

public static void aMethod() throws Exception

{

try /* Line 5 */

{

throw new Exception(); /* Line 7 */

}

finally /* Line 9 */

{

System.out.print("finally "); /* Line 11 */

}

}

public static void main(String args[])

{

try

{

aMethod();

}

catch (Exception e) /* Line 20 */

{

System.out.print("exception ");

}

System.out.print("finished"); /* Line 24 */

}

}


which line is an example of an inappropriate use of assertions?

public class Test2

{

public static int x;

public static int foo(int y)

{

return y * 2;

}

public static void main(String [] args)

{

int z = 5;

assert z > 0; /* Line 11 */

assert z > 2: foo(z); /* Line 12 */

if ( z < 7 )

assert z > 4; /* Line 14 */

switch (z)

{

case 4: System.out.println("4 ");

case 5: System.out.println("5 ");

default: assert z < 10;

}

if ( z < 10 )

assert z > 4: z++; /* Line 22 */

System.out.println(z);

}

}
























































































































Description:

Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is the underlying technology that powers state-of-the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices.

Discussion

Miranop

Gambling establishment Intestines can use you a large diapason of video games, consisting of card games, board games, modern rewards video games, video games with free spins and also much more. The website can additionally provide you generous prizes. However, there is none no deposit benefit pack, but there other charitable welcome perk plans about which you can learn even more details on the official web site. The safety service is on the highest level. This assures that no frauds can swipe your confidential information. If you discover any kind of questionable actions from your account or simply require any type of aid, you can contact the administration of Intestines through on the internet real-time chat. Well, as you can see, https://playfreegamesreview.comSee more

122 days 19 hours 10 minutes ago

Mick Murphy

This is terrible. Learn to write before you try test people.

2103 days 23 hours 18 minutes ago

Mohd Akmal

Not organized. misspelled.

2498 days 3 hours 52 minutes ago

1 Follower
Test: 1

Your Facebook Friends on WizIQ