SlideShare a Scribd company logo
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
class Test {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
$ javac test.java
$ java Test
Hello world!
$ javac < >
$ java < >
Java 스터디 강의자료 - 1차시
int a;
int b = 1;
int c, d, e = 2;
double f = 3.12312;
char g = 'A';
[ ] [ ];
[ ] [ ] = [ ];
[ ] [1 ], [2 ];
float ave = 5.16F;
long id = 2147483648L;
char ko = ' ';
boolean flag = true;
Java 스터디 강의자료 - 1차시
System.out.println(5 / 2);
int a = 1;
float b = a;
double c = b;
float ave = 3.75F;
int num = (int)ave;
int ii = 3.5; // 7
float f = 3.333; // 9
float ff = 3; // 10
char c = 'A'; // 12
char cc = 65; // 13
boolean b = 1; // 15
test.java:7: error: incompatible types: possible lossy conversion from
double to int
int ii = 3.5;
^
test.java:9: error: incompatible types: possible lossy conversion from
double to float
float f = 3.333;
^
Java 스터디 강의자료 - 1차시
int i, sum = 0;
for (i = 1; i <= 10; i++) {
if (i % 2 == 0)
sum += i;
}
System.out.println("Sum: " + sum);
int i = 2;
double r = Math.sqrt(i);
System.out.print("The square root of ");
System.out.print(i);
System.out.print(" is ");
System.out.print(r);
System.out.println(".");
The square root of 2 is 1.4142135623730951.
int i = 5;
double r = Math.sqrt(i);
System.out.println("The square root of " + i + " is " + r + ".");
The square root of 5 is 2.23606797749979.
int i = 2;
double r = Math.sqrt(i);
System.out.format("The square root of %d is %f.%n", i, r);
The square root of 2 is 1.414214.
import java.util.Scanner;
class Test {
public static void main(String[] args) {
int x;
Scanner input = new Scanner(System.in);
x = input.nextInt();
System.out.println(" : " + x);
}
}
123
: 123
String s = "this is a string";
String s1 = "cat";
String s2 = s1 + " dog";
System.out.println(s2);
// declares an array of integers
int[] anArray;
// allocates memory for 10 integers
anArray = new int[10];
anArray[0] = 100;
anArray[1] = 200;
System.out.println("Element at index 0: " + anArray[0]);
System.out.println("Element at index 1: " + anArray[1]);
System.out.println(anArray.length);
Java 스터디 강의자료 - 1차시
int v = 0;
for (int i = 1; i <= 3; i++) {
int v = 10;
v += i;
System.out.format("i=%2d, v=%dn", i, v);
}
System.out.format("Outer v=%dn", v);
i= 1, v=? i= 2, v=? i= 3, v=?
Outer v=?
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시

More Related Content

What's hot (20)

DOCX
System programmin practical file
Ankit Dixit
 
DOCX
01 list using array
SivakamiRaja1
 
TXT
System programs in C language.
Sudhakar Srivastava
 
PPTX
C Programming Language Part 4
Rumman Ansari
 
PDF
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Yothin Muangsommuk
 
TXT
New text document
Debranjan Pal
 
PDF
Perl 5.28 new features
brian d foy
 
PDF
C언어 스터디 강의자료 - 1차시
Junha Jang
 
DOCX
Ejercicios Scilab Completo
Ricardo Grandas
 
DOCX
Trabajo Scilab
alexistorres
 
DOCX
Taller De Scilab
Andrés Renteria
 
TXT
Data Structures : array operations in c program
Raghavendra Narayan
 
DOCX
Array imp of list
Elavarasi K
 
PPTX
Logic development
Jerin John
 
TXT
Uts
pencari buku
 
DOC
Java interface and inheritance
JaromirJagr
 
DOCX
WAP to find out whether the number is prime or not in java
One97 Communications Limited
 
PDF
6 things about perl 6
brian d foy
 
System programmin practical file
Ankit Dixit
 
01 list using array
SivakamiRaja1
 
System programs in C language.
Sudhakar Srivastava
 
C Programming Language Part 4
Rumman Ansari
 
Codemania101: The Present, Past and Future of Asynchronous Programming in Python
Yothin Muangsommuk
 
New text document
Debranjan Pal
 
Perl 5.28 new features
brian d foy
 
C언어 스터디 강의자료 - 1차시
Junha Jang
 
Ejercicios Scilab Completo
Ricardo Grandas
 
Trabajo Scilab
alexistorres
 
Taller De Scilab
Andrés Renteria
 
Data Structures : array operations in c program
Raghavendra Narayan
 
Array imp of list
Elavarasi K
 
Logic development
Jerin John
 
Java interface and inheritance
JaromirJagr
 
WAP to find out whether the number is prime or not in java
One97 Communications Limited
 
6 things about perl 6
brian d foy
 

Similar to Java 스터디 강의자료 - 1차시 (20)

PDF
Microsoft word java
Ravi Purohit
 
PPTX
Lecture 3.pptx
ShehabEldinSaid
 
PPS
Wrapper class
kamal kotecha
 
PPTX
Lecture 3 and 4.pptx
MAHAMASADIK
 
PDF
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
PDF
A comparison between C# and Java
Ali MasudianPour
 
PPTX
Java Programming Tutorials Basic to Advanced 2
JALALUDHEENVK1
 
DOCX
Import java
heni2121
 
PDF
PSI 3 Integration
Joseph Asencio
 
PPTX
Chapter i(introduction to java)
Chhom Karath
 
PDF
Sharable_Java_Python.pdf
ICADCMLTPC
 
PDF
03-Primitive-Datatypes.pdf
KaraBaesh
 
PPTX
Java Foundations: Data Types and Type Conversion
Svetlin Nakov
 
PDF
java-introduction.pdf
DngTin307322
 
PDF
Java
Sravya221181
 
PDF
Shiksharth com java_topics
Rajesh Verma
 
PPTX
บทที่ 3 พื้นฐานภาษา Java
Itslvle Parin
 
PDF
Java conceptual learning material
ArthyR3
 
PDF
Sam wd programs
Soumya Behera
 
PDF
Java session 3
Rajeev Kumar
 
Microsoft word java
Ravi Purohit
 
Lecture 3.pptx
ShehabEldinSaid
 
Wrapper class
kamal kotecha
 
Lecture 3 and 4.pptx
MAHAMASADIK
 
LECTURE 2 MORE TYPES, METHODS, CONDITIONALS.pdf
ShashikantSathe3
 
A comparison between C# and Java
Ali MasudianPour
 
Java Programming Tutorials Basic to Advanced 2
JALALUDHEENVK1
 
Import java
heni2121
 
PSI 3 Integration
Joseph Asencio
 
Chapter i(introduction to java)
Chhom Karath
 
Sharable_Java_Python.pdf
ICADCMLTPC
 
03-Primitive-Datatypes.pdf
KaraBaesh
 
Java Foundations: Data Types and Type Conversion
Svetlin Nakov
 
java-introduction.pdf
DngTin307322
 
Shiksharth com java_topics
Rajesh Verma
 
บทที่ 3 พื้นฐานภาษา Java
Itslvle Parin
 
Java conceptual learning material
ArthyR3
 
Sam wd programs
Soumya Behera
 
Java session 3
Rajeev Kumar
 
Ad

More from Junha Jang (8)

PDF
Flask 소수전공 강의자료 - 4차시
Junha Jang
 
PDF
Flask 소수전공 강의자료 - 3차시
Junha Jang
 
PDF
Flask 소수전공 강의자료 - 1차시
Junha Jang
 
PDF
Flask 소수전공 강의자료 - 2차시
Junha Jang
 
PDF
C언어 스터디 강의자료 - 5차시
Junha Jang
 
PDF
C언어 스터디 강의자료 - 4차시
Junha Jang
 
PDF
C언어 스터디 강의자료 - 3차시
Junha Jang
 
PDF
C언어 스터디 강의자료 - 2차시
Junha Jang
 
Flask 소수전공 강의자료 - 4차시
Junha Jang
 
Flask 소수전공 강의자료 - 3차시
Junha Jang
 
Flask 소수전공 강의자료 - 1차시
Junha Jang
 
Flask 소수전공 강의자료 - 2차시
Junha Jang
 
C언어 스터디 강의자료 - 5차시
Junha Jang
 
C언어 스터디 강의자료 - 4차시
Junha Jang
 
C언어 스터디 강의자료 - 3차시
Junha Jang
 
C언어 스터디 강의자료 - 2차시
Junha Jang
 
Ad

Recently uploaded (20)

PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
Electrical Engineer operation Supervisor
ssaruntatapower143
 
PPTX
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
PDF
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PDF
Design Thinking basics for Engineers.pdf
CMR University
 
PDF
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PPT
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
PDF
Digital water marking system project report
Kamal Acharya
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PPTX
Distribution reservoir and service storage pptx
dhanashree78
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PDF
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Electrical Engineer operation Supervisor
ssaruntatapower143
 
美国电子版毕业证南卡罗莱纳大学上州分校水印成绩单USC学费发票定做学位证书编号怎么查
Taqyea
 
SERVERLESS PERSONAL TO-DO LIST APPLICATION
anushaashraf20
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
Design Thinking basics for Engineers.pdf
CMR University
 
REINFORCEMENT LEARNING IN DECISION MAKING SEMINAR REPORT
anushaashraf20
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
Footbinding.pptmnmkjkjkknmnnjkkkkkkkkkkkkkk
mamadoundiaye42742
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Data structures notes for unit 2 in computer science.pdf
sshubhamsingh265
 
Digital water marking system project report
Kamal Acharya
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Distribution reservoir and service storage pptx
dhanashree78
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Viol_Alessandro_Presentazione_prelaurea.pdf
dsecqyvhbowrzxshhf
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 

Java 스터디 강의자료 - 1차시

  • 8. class Test { public static void main(String[] args) { System.out.println("Hello world!"); } } $ javac test.java $ java Test Hello world!
  • 9. $ javac < > $ java < >
  • 11. int a; int b = 1; int c, d, e = 2; double f = 3.12312; char g = 'A'; [ ] [ ]; [ ] [ ] = [ ]; [ ] [1 ], [2 ];
  • 12. float ave = 5.16F; long id = 2147483648L; char ko = ' '; boolean flag = true;
  • 14. System.out.println(5 / 2); int a = 1; float b = a; double c = b; float ave = 3.75F; int num = (int)ave;
  • 15. int ii = 3.5; // 7 float f = 3.333; // 9 float ff = 3; // 10 char c = 'A'; // 12 char cc = 65; // 13 boolean b = 1; // 15 test.java:7: error: incompatible types: possible lossy conversion from double to int int ii = 3.5; ^ test.java:9: error: incompatible types: possible lossy conversion from double to float float f = 3.333; ^
  • 17. int i, sum = 0; for (i = 1; i <= 10; i++) { if (i % 2 == 0) sum += i; } System.out.println("Sum: " + sum);
  • 18. int i = 2; double r = Math.sqrt(i); System.out.print("The square root of "); System.out.print(i); System.out.print(" is "); System.out.print(r); System.out.println("."); The square root of 2 is 1.4142135623730951.
  • 19. int i = 5; double r = Math.sqrt(i); System.out.println("The square root of " + i + " is " + r + "."); The square root of 5 is 2.23606797749979.
  • 20. int i = 2; double r = Math.sqrt(i); System.out.format("The square root of %d is %f.%n", i, r); The square root of 2 is 1.414214.
  • 21. import java.util.Scanner; class Test { public static void main(String[] args) { int x; Scanner input = new Scanner(System.in); x = input.nextInt(); System.out.println(" : " + x); } } 123 : 123
  • 22. String s = "this is a string"; String s1 = "cat"; String s2 = s1 + " dog"; System.out.println(s2);
  • 23. // declares an array of integers int[] anArray; // allocates memory for 10 integers anArray = new int[10]; anArray[0] = 100; anArray[1] = 200; System.out.println("Element at index 0: " + anArray[0]); System.out.println("Element at index 1: " + anArray[1]); System.out.println(anArray.length);
  • 25. int v = 0; for (int i = 1; i <= 3; i++) { int v = 10; v += i; System.out.format("i=%2d, v=%dn", i, v); } System.out.format("Outer v=%dn", v); i= 1, v=? i= 2, v=? i= 3, v=? Outer v=?