Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

Program Discussion :: Basics
Home > Programs > Basics

1. Write a program to print next to the last word of a sentence.

Answer:

<p>import java.io.BufferedReader;<br />
import java.io.IOException;<br />
import java.io.InputStreamReader;</p>

<p>public class StringWordIBM <br />
{</p>

<p>    public static void main(String[] args) throws IOException <br />
    {<br />
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));<br />
        String str;<br />
        System.out.println("Enter the String : ");<br />
        str=br.readLine();<br />
        System.out.println(str);<br />
        String s[] = str.split(" ");<br />
        System.out.println("Splitted string : ");<br />
        for(int i=0;i<s.length;i  )<br />
        {<br />
            System.out.println(s[i]);<br />
            <br />
        }<br />
        System.out.println("Second Last word of String is : " s[s.length-2]);<br />
    }<br />
    <br />
}</p>

Asked In ::  IBM   TCS  

Post Your Answer Here:

Name *
Email

Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here: