import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException; public class PreparedStmt {/** * PreparedStatement 테스트 */Connection con; static {try {Class.forName("oracle.jdbc.driver.OracleDriver");} catch (ClassNotFoundException cne) {cne.printStackTrace();}} public void connect() {try {con = DriverManager.getCo..
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; public class UDPClient { public static void main(String[] args) { // TODO Auto-generated method stub BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("보낼 자료 입력 : "); St..
import java.io.IOException;import java.io.PrintWriter;import java.net.InetAddress;import java.net.Socket; public class TCPClient { public static void main(String[] args) {// TODO Auto-generated method stub InetAddress ia = null;Socket socket = null;PrintWriter out = null;try {ia = InetAddress.getByName("127.0.0.1");socket = new Socket(ia, 5555);out = new PrintWriter(socket.getOutputStream(), tru..
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.net.InetAddress;import java.net.Socket; public class WebSocket { public static void main(String[] args) {// TODO Auto-generated method stub InetAddress ia = null; // 주소 참조 변수Socket sock = null; // 소켓 참조변수P..
import java.net.InetAddress;import java.net.UnknownHostException; public class IPDisplay { public static void main(String[] args) {// TODO Auto-generated method stub InetAddress ia = null;InetAddress[] ia2 = null; try {ia = InetAddress.getByName("www.daum.net");//URL로 접근System.out.println("server HostAddress : " + ia.getHostAddress());//호스트주소 출력System.out.println("server HostName : " + ia.getHos..
import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.IOException;import java.io.ObjectInputStream;import java.io.ObjectOutputStream;import java.io.Serializable; public class ObjectSerialize { public static void main(String[] args) {// TODO Auto-generated method stubObjectInputStream ois = null;ObjectOutputStream oos = null;FileInputStream fis = null;FileOutputStream fos ..
import java.awt.FlowLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileReader;import java.io.FileWriter; import javax.swing.JButton;import javax.swing.JFileChooser;import javax.swing.JFrame;import javax.swing.JOptionPane; public class FileBackup extends JFrame implements ..
import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.FileReader;import java.io.FileWriter; public class FileCopy { public static void main(String[] args) {// TODO Auto-generated method stub String str = null;try {BufferedReader reader = new BufferedReader(new FileReader("d:\\test.txt"));//기존의 텍스트 문서 읽음BufferedWriter writer = new BufferedWriter(new FileWriter("d:\\copy.txt")..