Techno programmer

Techno programmer

Share

CameraSet 11/05/2014

Bring all your camera in one app and take pictures

CameraSet

13/08/2013

public class TestOne implements Runnable
{
public static void main (String[] args) throws Exception
{
Thread t = new Thread(new TestOne());
t.start();
System.out.print("Started");
t.join();
System.out.print("Complete");
}
public void run()
{
for (int i = 0; i < 4; i++)
{
System.out.print(i);
}
}
}
What can be a result?
A Compilation fails.
B An exception is thrown at runtime.
C The code executes and prints "StartedComplete".
D The code executes and prints "StartedComplete0123".
E The code executes and prints "Started0123Complete".

13/08/2013

public class Drink implements Comparable
{
public String name;
public int compareTo(Object o)
{
return 0;
}
}
and:
Drink one = new Drink();
Drink two = new Drink();
one.name= "Coffee";
two.name= "Tea";
TreeSet set = new TreeSet();
set.add(one);
set.add(two);
A programmer iterates over the TreeSet and prints the name of each Drink object. What is the result?
A Tea
B Coffee
C Coffee Tea
D Compilation fails
E The code runs with no output.

13/08/2013

public class Score implements Comparable
{
private int wins, losses;
public Score(int w, int 1)
{ wins = w; losses = 1; }
public int getWins()
{ return wins; }
public int getLosses()
{ return losses; }
public String toString()
{
return “”;
}
// insert code here
}
Which method will complete this class?
A public int compareTo(Object o) {/*mode code here*/}
B public int compareTo(Score other) {/*more code here*/}
C public int compare(Score s1,Score s2){/*more code here*/}
D public int compare(Object o1,Object o2){/*more code here*/}

13/08/2013

Given classes defined in two different files:
package util;
public class BitUtils
{
public static void process(byte[])
{
/* more code here */
}
}

package app;
public class SomeApp
{
public static void main(String[] args)
{
byte[] bytes = new byte[256];
// insert code here
}
}
What is required at line 5 in class SomeApp to use the process method of BitUtils?
A process(bytes);
B BitUtils.process(bytes);
C util.BitUtils.process(bytes);
D SomeApp cannot use methods in BitUtils.
E import util.BitUtils.*; process(bytes);

Want your school to be the top-listed School/college in Hyderabad?
Click here to claim your Sponsored Listing.

Category

Telephone

Website

Address


Hyderabad