ersatish kumar

Greenhorn
+ Follow
since Nov 17, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ersatish kumar

Hi,
I am using Spring restful webservice and from there I am getting json object.
In Json Object I have byte array which i got after reading a pdf.
That Byte array I am trying to get in jsp page using ajax call.
Using ajax call i am able to retrieve byte array. But this byte array is coming as string which I am converting in action class and try to display pdf.
But error msg is coming as:
file does not begin with ' pdf-' in java

Do you have any idea why pdf is not displaying?
8 years ago
Hi,

Can some explains difference between Super and this in Java with an example?
1st of all thanks Matthew for clarifying my doubts. I am new to this forum. so i will keep your suggestion in my mind before posting the code
Hi,

I have doubt in this program.



How " new NewThread();" is calling " class NewThread() implements Runnable" ???

second doubt is when t.start() is calling then why main thread is printing 1st? According to me Child Thread should print 1st...

Can someone please explains the flow...
import java.util.Comparator;

import java.util.TreeSet;

class MyComp implements Comparator<String>{

@Override
public int compare(String o1, String o2) {
// TODO Auto-generated method stub
String aStr, bStr;
aStr= o1;
bStr=o2;
return bStr.compareTo(aStr);
}

}

public class TreeSetDemo {

public static void main(String[] args) {

TreeSet<String> ts = new TreeSet<String>(new MyComp());
ts.add("c");
ts.add("a");
ts.add("b");
ts.add("e");
ts.add("f");
ts.add("d");

for (String element : ts){
System.out.println(element+ " ");
//System.out.println();
}

}

}

Hello,

Can some explain how out is coming as
f
e
d
c
b
a

please explain this line: return bStr.compareTo(aStr);

A/C to my knowledge bStr.compareTo(aStr) returns 1,0,-1. So how output is returning as e d c b a ?