Lab1

Lab1 – ImageConverter

java2-lab1-ImageConverter

 

Lab1_1~ Lab1_4 프로젝트 디렉토리 안에 모든 파일(src/*.java & bin/*.class)와 보고서 (2~3장)를 넣고 Lab1_학번_이름.zip 압축한 후 e-learning(http://lms.dankook.ac.kr/index.jsp)으로 제출

 

Lab1_1 – command line arguments

Lab1_2 – method

Lab1_3 – class

Lab1_4 – try/catch/throw & for-loop

Lab1_5 – Scanner 클래스 & do/while-loop

static boolean convert(String inputImageFile, String outputImageFile, String format) throws IOException {

// file I/O

FileInputStream inputStream = new FileInputStream(inputImageFile);

FileOutputStream outputStream = new FileOutputStream(outputImageFile);

  // reads input image from file

BufferedImage inputImage = ImageIO.read(inputStream);     

// writes to the output image in specified format

  boolean result = ImageIO.write(inputImage, format, outputStream);

// needs to close the streams

outputStream.close();

inputStream.close();

// return result(true/false)

  return result;

}

JDK1.8 8u121

Java SE 8u121 Download & JDK8 Demos and Samples Download

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Windows x86 189.36 MB jdk-8u121-windows-i586.exe
Windows x86 53.81 MB jdk-8u121-windows-i586-demos.zip

Path 지정하기

Java version 확인하기

1.Notepad 사용하여 Java 코드 작성하기 (Notepad.exe Hello.java)

public class Hello {

public static void main(String[] args) {

System.out.println(“hello”);

}

}

2.컴파일 (javac Hello.java)

3.실행 (java Hello)