Wednesday 13 March 2013

PowerPoint Presentation On Packages & Interfaces Of Java


PowerPoint Presentation On Packages & Interfaces Of Java
java.io
&
java.util



Exploring java.util


Exploring java.util

Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).

The Complete Reference Java 7th Edition E-Book



The world's leading programming author offers comprehensive coverage of the new Java release The definitive guide to Java has been fully expanded to cover every aspect of Java SE 6, the latest version of the world's most popular Web programming language. This comprehensive resource contains everything you need to develop, compile, debug, and run Java applications and applets.

Java Program For Sorting A Given List Of Names In Alphabetical Order


/* Java Program For Sorting A Given List Of Names In Alphabetical Order */

// File Name: stringsort.java

Java program that reads a line of integers and then display each integer and the sum of all integers



/* Java program that reads a line of integers and then display each integer and the sum of all integers (Use StringTokenizer Class Of java.util)*/

// File Name: sumofintegers.java

import java.io.*;
import java.util.*;
class sumofintegers {
public static void main(String arg[]) throws IOException {
int sum=0,n;
String s;
DataInputStream in=new DataInputStream(System.in);
System.out.print("Enter The Integers Saperating Them With Space ");
s=in.readLine();
StringTokenizer token =new StringTokenizer(s);
while(token.hasMoreTokens())
{
n=Integer.parseInt(token.nextToken());
sum+=n;
System.out.println(n);
}
System.out.println("Sum Of All The Integers Is : "+sum);
System.out.println("www.shashanktechnologies.blogspot.com");
}
}


Output:

Compilation: G:/shashank>javac sumofintegers.java

Interpretation: G:/shashank>java sumofintegers





Java Program That Checks whether A Given String Is A Palindrome Or Not


/* Java Program That Checks whether A Given String Is A Palindrome Or Not */

// File Name: palindrome.java

Tuesday 12 March 2013

Java Program To Multiply Two Given Matrices


/* Java Program To Multiply Two Given Matrices*/
// File Name: matmult.java

Java Program To Print Prime Numbers Using Command-Line Arguments


/* Java Program That Promotes The User For An Integer And Then Prints Out
All Prime Numbers upto That integer */

Java Program To Print Prime Numbers


/* Java Program That Promotes The User For An Integer And Then Prints Out
All Prime Numbers upto That integer */

// File Name: prime.java

import java.io.*;
class prime {
public static void main(String[] args) throws IOException {
String s;
int n,i,j;
DataInputStream in=new DataInputStream(System.in);
System.out.print("Enter The Number:");
s=in.readLine();
n=Integer.parseInt(s);
System.out.println("Given Value Of n Is :"+n);
System.out.print("Prime numbers Generated For "+n+" Are :");
for(i=0;i<n;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(i==j)
System.out.print(i+",");
}
System.out.print("\n");
System.out.println("www.shashanktechnologies.blogspot.com");
}
}


OUTPUT:

COMPILATION: G:\shashank>javac prime.java

INTERPRETATION: G:\shashank>java prime





Java Program For Generating Fibonacci Sequence With Recursion Method


/* Java Program For Generating Fibonacci Sequence Is Defined by The Following Rule:
The first two values in the sequence are 1 & 1. Every subsequent value is the
sum of two values preceding it.*/

Java Program For Generating Fibonacci Sequence


/* Java Program For Generating Fibonacci Sequence Is Defined by The Following Rule:
The first two values in the sequence are 1 & 1. Every subsequent value is the
sum of two values preceding it.*/

// File Name: fibonacci.java

import java.io.*;
class fibonacci {
public static void main(String args[]){
int a=1,b=1,c=a+b,n;
n=Integer.parseInt(args[0]);
                System.out.println("www.shashanktechnologies.blogspot.com");
System.out.println("Given Value For n Is:"+n);
System.out.print("Fibonacci Sequence Generated For "+n+" Is: ");
System.out.print(a+","+b+",");
while(c<=n){
System.out.print(c+",");
a=b;
b=c;
c=a+b;
}

}
}


OUTPUT:

COMPILATION: G:\shashank>javac fibonacci.java

INTERPRETATION: G:\shashank>java fibonacci 10





Java program to print all real solutions to the qudratic eq ax2+bx+c=0 Read a,b,c values and use the formula (–b+sqrt(b2-4ac))/2a


/* Java program to print all real solutions to the
qudratic eq ax2+bx+c=0 Read a,b,c values
and use the formula (–b+sqrt(b2-4ac))/2a */

Java program to print all real solutions to the qudratic eq ax2+bx+c=0 Read a,b,c values and use the formula (–b+sqrt(b2-4ac))/2a with command-line arguments



/* Java program to print all real solutions to the
qudratic eq ax2+bx+c=0 Read a,b,c values
and use the formula (–b+sqrt(b2-4ac))/2a  with command-line arguments*/