import java.io.*;
class abc
{
public static void main(Stringa aa[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a sentence");
String S=br.readLine();
S=S.trim();
S=" "+S+" ";
int L=S.length(),a=L;
for(int i=L-1; i>=0; i--)
{
if(S.charAt(i)==32)
{
System.out.print(S.substring(i+1,b)+" ");
b=i;
}
}
}
}
This site has got programs, that u may need as an ISC student or a beginner. These are simple console based programs that can be run and understood by anyone having the idea of basic, core Java concepts. (java programs for beginners)
Friday, March 9, 2012
Thursday, March 8, 2012
Javaprogram to print the first and last letters of all words in a program
import java.io.*;
class abc
{
public static void main(Stringa aa[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a sentence");
String S=br.readLine();
S=S.trim();
S=" "+S+" ";
int a=1, L=S.length();
for(int i=1; i
{
if(S.charAt(i)==32)
{
System.out.print(S.charAt(a));
if((i-1)!=a)
System.out.print(S.charAt(i-1));
System.out.print(" ");
a=++i;
}
}
}
}
class abc
{
public static void main(Stringa aa[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a sentence");
String S=br.readLine();
S=S.trim();
S=" "+S+" ";
int a=1, L=S.length();
for(int i=1; i
if(S.charAt(i)==32)
{
System.out.print(S.charAt(a));
if((i-1)!=a)
System.out.print(S.charAt(i-1));
System.out.print(" ");
a=++i;
}
}
}
}
Subscribe to:
Posts (Atom)