Remote Method Invocation RMI program code using Java

The program is written 3 files namely :RMI.java , RMIserver.java, RMIclient.java. This program implements RMI concept in java . The Java Remote Method Invocation Application Programming Interface, or Java RMI, is a Java API that performs the object-oriented equivalent of remote procedure calls , with support for direct transfer of serialized Java objects and distributed garbage collection. CODE: RMI.java import java.rmi.*; public interface RMI extends Remote { void receiveMessage(String x) throws RemoteException; } RmiServer.java import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; import java.net.*; public class RmiServer extends java.rmi.server.UnicastRemoteObject implements RMI {     int     ...
Read more »

Revers Name Resolution Program code using java

PROGRAM NAME: REVERSE NAME RESOLUTION In computer networking, reverse DNS lookup or reverse DNS resolution (rDNS) is the determination of a domain name that is associated with a given IP address using the Domain Name Service (DNS) of the Internet. COMPLIED USING : JAVA JDK or NETBEANS IDE CODE: ReverseNameResolution.java import java.net.*; import java.util.Scanner; class ReverseNameResolution {     public static void main(String[] args) {         System.out.println("Enter the IP address of the pc :-");         Scanner in=new Scanner(System.in);         String ip=in.nextLine();        ...
Read more »

Java Program code to count vowels in given word

The program counts the number of vowels in the given word Complied using JDK and Netbeans IDE Code: package vowels; import java.io.*; public class vowels { public static void main(String[] args)throws IOException { BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the string "); String s=stdin.readLine(); int count=0; for(int i=0;i<s.length();i++) { char c=s.charAt(i); if(c=='a' || c=='e' || c=='i' ||...
Read more »

Multiple inheritance Program Code in Java

The code Below implements the concept of multiple inheritance.The program takes Roll number of student as input using one class. Then Marks obtained in two subject .Later the marks are added together along with bonus marks and total is printed.The code is implemented using multiple inheritance concept in mind. You can use JDK or Netbeans IDE to run below code. CODE: package mulinheritance; import java.io.*; class student { int rn; void getNumber(int n) { rn = n; } void putNumber() { System.out.println("Roll...
Read more »

Code For Validating Email String Number Html Forms using javascript

Validation is very important when we deal with anything processing on web. The data must be validated before it is entered into the database. Validation could be on server side as well as client side. We are going to focus on validation using java script on the client side.With The below code you can validate Names which is a string , Age which is a number and a email which has syntax such as email@email.com. To run this code you just need a java script enabled browser to test. copy the code and rename the file with .html extension. Code:(Put it into text file and rename the file with .html extension) <html> <head> <title> Register...
Read more »

Palindrome Program in Java

The Program was complied using Netbeans IDE. PROGRAM: package palindrome; import java.io.*; public class palindrome { public static void main(String[] args)throws IOException { BufferedReader st=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the String "); String str=st.readLine(); String s=""; for(int i=(str.length())-1;i>=0;i--) s=s+str.charAt(i); if(s.equals(str)) System.out.println(str+" is Palindrome "); else System.out.println(str+" is not a Palindrome"); } } OUTPUT: Enter the String  aga aga is Palindrome...
Read more »

Java program to calculate sum of integers between given numbres

The program was complied using Netbeans IDE . PROGRAM: package intby7; import java.io.*; public class intby7 { public static void main(String[] args)throws IOException { BufferedReader st=new BufferedReader(new InputStreamReader(System.in)); try { System.out.println("Enter the no from"); int no=Integer.parseInt(st.readLine()); System.out.println("Enter the no to"); int nn=Integer.parseInt(st.readLine()); int sum=0; for(int i=no;i<nn;i++) { int rem=i%7; if(rem==0) { System.out.println(i); sum=sum+i; } } System.out.println("The sum of integer between "+no+" and "+nn+" is "+sum); } catch(Exception...
Read more »

Implementing Client Server chat Program in Java computer Networks Concept

Here is a client server program implemented in java . The program was complied using Netbeans IDE with both programs opened in different tabs and was able to make connection and send messages from client to server. The program was tested in LAN network. if you are working on some other network please make changes required in the code. CLIENT.JAVA package cn;import java.io.*;import java.net.*;//cleint side programpublic class client{    Socket requestSocket;    ObjectOutputStream out;    ObjectInputStream in;    String msg;    int portno;    server(){}    void run()    {        try        {            portno=2004;     ...
Read more »

Java Program to convert temperature from Degree to Fahrenheit

Program complied with Netbeans IDE you can also use JDK and compile in command prompt . PROGRAM: package celtofar;import java.io.*; public class celtofar { public static void main(String[] args) throws IOException { BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter the temperature in celcius: "); double cel=Double.parseDouble(in.readLine()); double far=(cel*9)/5+32; System.out.println("The Fahrenheit is "+far); }} OUTPUT: Enter the temperature in celcius: 40 The Fahrenheit is 104.0...
Read more »

Java Program to Sort string in alphabetical order

Program complied with Netbeans IDE you can also use JDK and compile in command prompt . PROGRAM: package alphaorder;import java.io.*;import java.util.*; public class alphaorder { public static void main(String[] args)throws IOException { BufferedReader st=new BufferedReader(new InputStreamReader(System.in)); String str; System.out.println("Enter the string "); str=st.readLine(); char[] charArray = str.toCharArray(); Arrays.sort(charArray); String nstr = new String(charArray); System.out.println("The sorted string is "+nstr); } } OUTPUT: Enter the string dcbaThe sorted string is abcd...
Read more »

Simplex Method Program in C++ Operation Research Concept

Here is the code in C++ for simplex method problem .This code is well tested for number of inputs . You need VB 6 or TURBO C complier to run this code. PROGRAM: #include <stdio.h>#include <math.h> #define CMAX 10 #define VMAX 10 int NC, NV, NOPTIMAL,P1,P2,XERR; double TS[CMAX][VMAX]; void Data() { double R1,R2; char R; int I,J; printf("\n SIMPLEX METHOD\n\n"); printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R); printf("\n NUMBER OF VARIABLES OF THE FUNCTION ? "); scanf("%d", &NV); printf("\n NUMBER OF CONSTRAINTS ? "); scanf("%d", &NC); if (R == 'Y' || R=='y') R1 = 1.0; else R1 = -1.0; printf("\n INPUT COEFFICIENTS OF THE FUNCTION:\n"); for (J = 1; J<=NV; J++) { printf(" #%d ? ", J); scanf("%lf", &R2);...
Read more »

Image Creation Program using Java Image Processing Concept

So here is the program code written in Java Complied using netbeans or JDK 5 or 6 PROGRAM: package pgm1;import java.awt.*;import java.awt.event.*;import java.applet.*;import java.awt.image.*;/*<applet code="expt1" width=100 height=100></applet>*/public class pgm1 extends Applet implements ActionListener{Button y;Image img1,img2,img3;int width=200,height=20;int size=width*height;int x=200;int w=20;int z=x*w;int p_buffer1[]=new int[size];int p_buffer2[]=new int[z];int p_buffer3[]=new int[size];public void init(){int r=0XFF;int g=0x00;int b=0X00;y=new Button("create");add(y);y.addActionListener(this);for(int i=0;i<size;i++){p_buffer1[i]=(255<<24)|(r<<16)|(g<<8)|b;}img1=createImage(new...
Read more »