본문 바로가기

예제

리눅스 쉘 프로그래밍 for문 예제 리눅스 쉘 프로그래밍 쉘 스크립트 for문 예제 linux shell programming / shell script / for loop i 를 1에서부터 5까지 증가 시키는 for문 예제 #!/bin/bash for i in 1 2 3 4 5 do echo "Welcome $i times" done또는 #!/bin/bash for i in {1..5} do echo "Welcome $i times" done와 같이 작성하면 됩니다. 그러면 아래와 같은 결과를 얻을 수 있습니다. Welcome 1 times Welcome 2 times Welcome 3 times Welcome 4 times Welcome 5 times 더보기
Java FileWriter - 파일에 Hello World 출력하기 예제 Java FileWriter, fstream, BufferedWriter 사용법 Java 코딩, txt 파일에 문장 쓰기 출력하기 프린트 하기 자바에서 원하는 문장을 파일을 만들어 그곳에 저장해 봅시다. 아래와 같이 하면 out.txt 파일에 Hello World 라는 문장이 저장 됩니다. import java.io.*; class FileWrite { public static void main(String args[]) { try{ // Create file FileWriter fstream = new FileWriter("out.txt"); BufferedWriter out = new BufferedWriter(fstream); out.write("Hello World"); //Close the ou.. 더보기
비트 연산자 활용법 비트 연산자 활용법 출처: Bit Twiddling Hacks By Sean Eron Anderson seander@cs.stanford.edu Individually, the code snippets here are in the public domain (unless otherwise noted) — feel free to use them however you please. The aggregate collection and descriptions are © 1997-2005 Sean Eron Anderson. The code and descriptions are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY and.. 더보기