Click here to Skip to main content
15,908,173 members
Home / Discussions / Java
   

Java

 
QuestionApplet Automation Pin
Member 909935222-Apr-14 20:06
professionalMember 909935222-Apr-14 20:06 
AnswerRe: Applet Automation Pin
TorstenH.23-Apr-14 1:11
TorstenH.23-Apr-14 1:11 
GeneralRe: Applet Automation Pin
Member 909935223-Apr-14 1:41
professionalMember 909935223-Apr-14 1:41 
QuestionConstructor problem Pin
john_meee21-Apr-14 23:16
john_meee21-Apr-14 23:16 
AnswerRe: Constructor problem Pin
TorstenH.23-Apr-14 1:22
TorstenH.23-Apr-14 1:22 
AnswerRe: Constructor problem Pin
vipul57412-Jun-14 21:46
vipul57412-Jun-14 21:46 
QuestionIs there a pre-defined mthod in java works same as GetFontData pre-defined function in C++ Pin
f2620-Apr-14 20:44
f2620-Apr-14 20:44 
AnswerRe: Is there a pre-defined mthod in java works same as GetFontData pre-defined function in C++ Pin
TorstenH.23-Apr-14 1:25
TorstenH.23-Apr-14 1:25 
GeneralRe: Is there a pre-defined mthod in java works same as GetFontData pre-defined function in C++ Pin
f2630-Apr-14 22:58
f2630-Apr-14 22:58 
Questionhow to create exe file Pin
mrraviprakash18-Apr-14 0:30
mrraviprakash18-Apr-14 0:30 
SuggestionRe: how to create exe file Pin
Richard MacCutchan18-Apr-14 3:45
mveRichard MacCutchan18-Apr-14 3:45 
Questionj2me bluetooth application Pin
usic vicky15-Apr-14 19:46
usic vicky15-Apr-14 19:46 
AnswerRe: j2me bluetooth application Pin
Richard MacCutchan15-Apr-14 22:21
mveRichard MacCutchan15-Apr-14 22:21 
Questionroom allocation and optimisation Pin
Member 1032564514-Apr-14 7:47
Member 1032564514-Apr-14 7:47 
SuggestionRe: room allocation and optimisation Pin
Richard Deeming14-Apr-14 9:00
mveRichard Deeming14-Apr-14 9:00 
AnswerRe: room allocation and optimisation Pin
Bernhard Hiller14-Apr-14 22:52
Bernhard Hiller14-Apr-14 22:52 
Questionchat application Pin
nik-123414-Apr-14 7:15
nik-123414-Apr-14 7:15 
AnswerRe: chat application Pin
Richard MacCutchan14-Apr-14 21:52
mveRichard MacCutchan14-Apr-14 21:52 
AnswerRe: chat application Pin
mkumar_mtech15-Apr-14 1:57
professionalmkumar_mtech15-Apr-14 1:57 
Questionhow to apply horizental scroll bar in jsf Pin
sunil khichar11-Apr-14 7:26
sunil khichar11-Apr-14 7:26 
AnswerRe: how to apply horizental scroll bar in jsf Pin
Richard MacCutchan11-Apr-14 7:45
mveRichard MacCutchan11-Apr-14 7:45 
QuestionString Reverse Pin
V$ethi5-Apr-14 3:27
V$ethi5-Apr-14 3:27 
Hi , I am just trying to reverse all the words of a string at their place only ex if there is a string : "vandana is a good girl" then the out put of the program should be "anadnav is a doog lrig" for that i have created a package to calculate the no of words in the string and also for calculating reverse of a string that pacage is:
package p1;
public class meth
{
public int cal(String s)
{
int wrd=0;
for(int i=0;i<s.length();i++)
{
char c=s.charAt(i);
if(Character.isWhitespace(c))
{
wrd++;
}
}
return wrd+1;
}
public String rev(String b)
{
String p="";
for(int i=0;i<b.length();i++)
{
p=b.charAt(i)+p;
}
return p;
}
}
-----------------------------------------------------------------And the code of my program is :
import p1.*;
import java.io.*;
class rv
{
public static void main(String args[]) throws IOException
{
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
System.out.println("Enter your string :");
String s=br.readLine();
meth ob=new meth();
int n=ob.cal(s);
String m="";
while(n>=0)
{
for(int i=0;i<s.lenght();i++)
{
char c=s.charAt(i);
if(Character.isWhitespace(c))
{
String p=s.substring(0,i);
meth ob1=new meth();
String sb=ob1.rev(p);
m=m+" "+sb;
s=s.substring(i+1,s.length());
}
}
n--;
}
System.out.println(m);
}
}
but the problem is my program gives different different out put and it's not working well and i've tired Sleepy | :zzz: to understand th problem.

-- modified 5-Apr-14 14:25pm.
AnswerRe: String Reverse Pin
Richard MacCutchan5-Apr-14 3:47
mveRichard MacCutchan5-Apr-14 3:47 
GeneralRe: String Reverse Pin
V$ethi5-Apr-14 6:24
V$ethi5-Apr-14 6:24 
GeneralRe: String Reverse Pin
Richard MacCutchan5-Apr-14 6:47
mveRichard MacCutchan5-Apr-14 6:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.