Remote Command Server & Client Friday, Dec 12 2008 

Remote Command Execution

rceServer

import java.io.*;

import java.net.*;

public class rceserver

{

public static void main(String a[])throws IOException

{

ServerSocket s = new ServerSocket(8001);

System.out.println(“Started: “+ s);

try

{

Socket scr = s.accept();

(more…)

Advertisements

Datagram Server & Client Friday, Dec 12 2008 

Socket Programming – UDP

DatagramClient

import java.io.*;

import java.net.*;

class datagramclient

{

public static DatagramSocket ds;

public static byte buffer[]= new byte[1024];

public static int clientport = 789, serverport = 790;

public static void main(String args[]) throws Exception

{

ds=new DatagramSocket(serverport);

(more…)

Chat Server & Client Friday, Dec 12 2008 

Socket Programming TCP/IP

Chat Client

import java.io.*;

import java.net.*;

public class chatclient

{

public static void main(String args[])

{

String line;

String myline;

BufferedReader in=null;

try

{

Socket s=new Socket(“localhost”,8182);

(more…)

Day Time Server & Client Friday, Dec 12 2008 

//TDSERVER

import java.net.*;

import java.io.*;

import java.util.*;

import java.text.*;

class tdserver

{

public static void main(String a[]) throws Exception

{

ServerSocket ss;

Socket s;

PrintStream p;

DataInputStream din;

Date d1=new Date();

ss=new ServerSocket(8000);

s=ss.accept();

(more…)

Core Java – Technical Questions 2 Friday, Dec 12 2008 

What is Abstract factory? And its use?

  1. Users of an Abstract Factory can create families of related objects without any knowledge of their concrete classes.

2.      Using references to interfaces instead of references to concrete classes is an important way of minimizing ripple effects.

3.      The user of an interface reference is always protected from changes to the underlying implementation.

How we restrict to inherit a class?

By using final keyword

How we call a method without creating the instance of an object?

By using the static keyword

How we create a String instance without using new keyword?

(more…)

Next Page »