for(i=0;i<100;i++)
{
int i=method();//method returns no's from 1 to 10;


/*
insert some stmts which can give output like no.of times
numbers(1-10) returned. (for example if it returns 2 then i
want output how many times 2 returned) like that i want
output for no's 1 - 10 how many times each no returned.

*/

}

Answers were Sorted based on User's Feedback



for(i=0;i<100;i++) { int i=method();//method returns no's from 1 to 10; /* insert so..

Answer / abhishek.cusat.it2007

class X
{
public void method()
{
int x=0;
do{
x++;
System.out.println(x);
}
while(x<10);
{
System.out.println("this is your Ptogaram");
}

}

public static void main(String[] as)
{
X a=new X();
for(int i=0;i<100;i++)
{
a.method();
break;
}
}
}

Is This Answer Correct ?    3 Yes 2 No

for(i=0;i<100;i++) { int i=method();//method returns no's from 1 to 10; /* insert so..

Answer / abhishek kumar

class X
{
public void method()
{
int x=0;
do{
x++;
System.out.println(x);
}
while(x<10);
{
System.out.println("this is your Ptogaram");
}

}
public static void main(String[] as)
{
X a=new X();
for(int i=0;i<100;i++)
{
a.method();
break;
}
}
}

Is This Answer Correct ?    2 Yes 2 No

for(i=0;i<100;i++) { int i=method();//method returns no's from 1 to 10; /* insert so..

Answer / $ourav

static int []arr=new int[10];
arr[i]++;

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Core Java Interview Questions

class{ ... ... interface myinterface{ ... ... } abstract class{ .. .. } ... .. .. } is this possible to write "Interface and/ or Abstract class inside a class ? if possible whcich one is possible is only interface? is only abstract?

2 Answers   Logica CMG,


Explain about doubly linked list

0 Answers   Aditi Placement Service,


What happens when a class is made static like if a field or member is made static it becomes class variable and is shared by all the object of the class?

1 Answers  


How many threads can I run java?

0 Answers  


Is age a discrete variable?

0 Answers  






How is java created?

0 Answers  


Is java based on c?

0 Answers  


What is the difference between serialization and deserialization?

3 Answers   ABC,


How many Java environments are there?

1 Answers   Phantom Technologies,


What is the difference(or similarity if there are some) between object and a variable?

4 Answers   ME,


Why is multiple inheritance not supported in java?

0 Answers  


What is the difference between DataInputStream and BufferedReader

2 Answers   Hexagon,


Categories