Vinay Dinakar

Greenhorn
+ Follow
since Dec 30, 2008
Merit badge: grant badges
For More
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vinay Dinakar

Hi,

I am trying to upload file using POSTMAN REST client. i have configured Content-Type=multipart/form-data;boundary=---------------------------sdjkahdj294919323195 and file=<file.txt>

This is my controller.



Added this in spring.xml


But when i send url http://localhost:8080/myapp/rest/uploadfile.json , i am getting HTTP Status 400 - The request sent by the client was syntactically incorrect ().

Can anyone help in finding the mistake.

Thanks in advance
Vinay
10 years ago
what i can see from this example


is that, line1 creates one object in heap ("abc") and in line 2, "def" goes to string constant pool and sb (line 1 's object) value gets modified. so total 2 objects. line 3 does not have any effect.
More ? how many in this example. if sb.append(" ") creates one more then String s1 = s1+" " also creates one. is it ?
Arent these string literal also objects ? then how 3 objects gets created, it should be only one right. if it is 3 objects, then whats the difference between string and stringbuffer !!! ?
Ok. Thats fine. But my question is , compiler sees that test method return type is "int". But there is no "return" statement gets called here. So Why compiler doesn't say like "return statement is missing" ?


System.exit(0) makes control to return without executing finally block (Which is having return statement). So now there is no return value, why doesn't compiler throws an error ?
Can you explain with an example. i can declare like this , static final Integer i=20;



My question is:

-- Tell me if my assumptions are correct or wrong , which i mentioned in comments ?
-- how different it is when overloading var-agrs (int... i) and (float... f) from (int i) and (float f). ?
It worked fine for me.
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)



output:
====
test

This is only when foo(String... s) . otherwise it will be test1
Here method invocation will be decided at runtime. then how come

a A= new Main();
A.foo("dd");

invokes foo method of 'a' class ?
Any takers for james question ??
Thanks a lot for clarifying my doubt !.


My question is - What exactly Object 'a' will be containing internally? why a.f() executes 'class B' s method and why 'a.sub()' gives an error ? In short what is the internal structure of object 'a' in this case ?
How about "Thinking in java" by Bruce Eckel. I read K & B , now started reading "Thinking in java" . Its a very good book..