Q.Write a java program to count the number of words in the entered sentence
import java.io.*;
public class CountWords
{
public static void main(String args[])throws Exception
{
BufferedReader stdin =new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the sentence: ");
String s=stdin.readLine();
s=' '+s;
char ch;
int...
Monday, 14 April 2014
Printing Patterns....
Q.Write a program to print the following pattern
*
* *
* * *
* * * *
* * * * *
public class HalfTriangle
{
public void pattern(int n)
{
for(int i=1;i<=n;i++) //to define the number of rows
{
for(int j=1;j<=i;j++)
...
Simple programs for beginner's
Q.Write a java program to add two numbers.
public class addNum
{
public void sum(int x,int y) // creates the instance of a class
{
int z=x+y;
System.out.print(z);
}
}
Q.Write a java program to subtract two numbers.
public class Difference
...
This blog is mainly a guide for isc computer science students...Some solved questions are given in this blog and also guidance to java progaram....icse students can also refer to this site for learning programs...