Program : Client-Server Program using TCP/IP By : Kapil Lohia Program 1: import java.net.*; import java.io.*; class tcpip_server { public static void main(String args[]) throws IOException { ServerSocket n1=null; try { n1=new ServerSocket(98); } catch(IOException e) { System.err.println("Port 98 could not be found"); System.exit(1); } Socket c=null; try { c=n1.accept(); System.out.println("Connection from "+c); [...]
Program : DatagramSocket and DatagramPacket (Client-Server Program using UDP/IP) By : Kapil Lohia Program 1 : import java.net.*; class udpip_server { public static DatagramSocket ds; public static byte buffer[]=new byte[1024]; public static void Myserver() throws Exception { int pos=0; while(true) { int c=System.in.read(); switch(c) { case -1: System.out.println("Server quits"); return; case ‘\r’:break; [...]
Program : Uniform Resource Locator (URL) By : Kapil Lohia import java.net.*; import java.io.*; class url { public static void main(String args[]) throws Exception { URL n1 = new URL("http://java.sun.com:80/docs/index#down"); System.out.println("Protocol:"+n1.getProtocol()); System.out.println("Host :"+n1.getHost()); System.out.println("File Name :"+n1.getFile()); System.out.println("Port :"+n1.getPort()); System.out.println("Reference :"+n1.getRef()); } }
To implement a Color Section from a given set of Color. import java.awt*; import java.awt.event.*; import java.applet.*; public class fillcolor extends Applet implement Item Listener { checkbox red,yellow,black,blue.orange; CheckboxGroup cbg; String msg; String s1="red"; String s2="yellow"; String s3="black"; String s4="orange"; public void init() { cbg = new CheckboxGroup(); red = new Chechbox("red",cbg,true); yellow= new [...]
JPanel p = new JPanel();
p.setLayout(new GridLayout(4, 4));
String buttons = “789/456*123-0.=+”;
for (int i = 0; i < buttons.length(); i++)
addButton(p, buttons.substring(i, i + 1));
add(p, “Center”);
ServerSocket ss=new ServerSocket(2000);
Socket s=ss.accept();
BufferedReader br=new BufferedReader(newInputStreamReader(s.getInputStream()));
double rad,area;
String result;
Sunday, October 4th, 2009 »
Posted By Ranjith » Total 17 Comments
public void init()
{
addKeyListener(this);
requestFocus();
setBackground(Color.green);
setForeground(Color.blue);
}
Sunday, October 4th, 2009 »
Posted By Ranjith » Total 1 Comment
Write a Java program that computes the payment of a loan based on the amount of the loan, the interest rate and the number of months. It takes one parameter from the browser: Monthly rate;if true, the interest rate is per month; Otherwise the interest rate is annual.
Sunday, October 4th, 2009 »
Posted By Ranjith » Total 3 Comments
public void init()
{
msg+=”init()—>”;
setBackground(Color.orange);
}
Enter input string
a+b*c
Input String:a+b*c
Output String:
abc*+
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Resources #Terms of Use
Copyright©2012 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com