{Java Technology “Hello, World!” Dr. Sergey Krylov

Скачать презентацию {Java Technology “Hello, World!” Dr. Sergey Krylov Скачать презентацию {Java Technology “Hello, World!” Dr. Sergey Krylov

Java_Tech_1.pptx

  • Размер: 1.5 Мб
  • Автор:
  • Количество слайдов: 20

Описание презентации {Java Technology “Hello, World!” Dr. Sergey Krylov по слайдам

{Java Technology “Hello, World!” Dr. Sergey Krylov {Java Technology “Hello, World!” Dr. Sergey Krylov

 Start and finish Break Facilities, telephones and messages Questions and discussions LOGISTICS Start and finish Break Facilities, telephones and messages Questions and discussions LOGISTICS

BASICSQ. What is a program? Ans.  A sequence of instructions that a computer can interpretBASICSQ. What is a program? Ans. A sequence of instructions that a computer can interpret and execute. Q. Why Java and not Hindi / Marathi / English? Ans. Since, so far , computer is not intelligent enough to understand natural languages.

PROGRAMMING Task definition Making of Algorithm, Writing Code Compilation, Execution PROGRAMMING Task definition Making of Algorithm, Writing Code Compilation, Execution

TO MAKE PROGRAM Step 1: Source Code Step 2: Compiling Step 3: Load into device StepTO MAKE PROGRAM Step 1: Source Code Step 2: Compiling Step 3: Load into device Step 4: Execute

TOOLS 1) Code editor 2) Compiler 3) Execution environment 4) Debugger TOOLS 1) Code editor 2) Compiler 3) Execution environment 4) Debugger

ECLIPSE START Remember the location in the field! Workspace – project files location. ECLIPSE START Remember the location in the field! Workspace – project files location.

PROJECT AND CLASS File  New  Java Project⇒ ⇒  File  New  Class⇒PROJECT AND CLASS File New Java Project⇒ ⇒ File New Class⇒ ⇒

ECLIPSE INTERFACE Right click to add class Write source code Compile errors Executio n output. RightECLIPSE INTERFACE Right click to add class Write source code Compile errors Executio n output. Right click to locate file

CLASSClass definition Method body public class Program 1 { public static void main (String[] args) {CLASSClass definition Method body public class Program 1 { public static void main (String[] args) { } }

JAVA PROJECT Klass_1 Klass_2 Klass_N… method 1 method 2 method K … field 1 field 2JAVA PROJECT Klass_1 Klass_2 Klass_N… method 1 method 2 method K … field 1 field 2 field. M …Import Klass_G

HELLO, WORLD class import java. io. Print. Stream; public class Program 1 {  public staticHELLO, WORLD class import java. io. Print. Stream; public class Program 1 { public static Print. Stream out = System. out; public static void main (String[] args) { out. println(“Hello, World!”); } }create object method call

HELLO, WORLD 13 import java. io. Print. Stream;  public class Program 1 { public staticHELLO, WORLD 13 import java. io. Print. Stream; public class Program 1 { public static Print. Stream out = System. out; public static void main(String[] args) { out. println(«Hello, world!»); } } Standard Java class. Name is equal to source file name Start Eclipse and write the program The first method to run Path to find needed classes Create output object

 Compiling:  is the process of translating source code written in a particular programming language Compiling: is the process of translating source code written in a particular programming language into computer-readable machine code that can be executed. $ javac First. java This command will produce a file ‘First. class’, which is used for running the program with the command ‘java’. Running: is the process of executing program on a computer. $ java First COMPILING AND RUNNING Eclipse ->>>

CONSOLE OUTPUT CONSOLE OUTPUT

PRINTING ON THE SCREEN 1. System. out. println(“Hello World”); – outputs the string “Hello World” followedPRINTING ON THE SCREEN 1. System. out. println(“Hello World”); – outputs the string “Hello World” followed by a new line on the screen. 2. System. out. print(“Hello World”); — outputs the string “Hello World” on the screen. This string is not followed by a new line. 3. Some Escape Sequence – • \n – stands for new line character • \t – stands for tab character

TIPS ON PROGRAMMING • Some common errors in the initial phase of learning programming: - TIPS ON PROGRAMMING • Some common errors in the initial phase of learning programming: — Mismatch of parentheses — Missing ‘; ’ at the end of statement — Case sensitivity • The best way to learn programming is writing a lot of programs on your own.

Write a program that prints three lines of text. HOMEWORK Write a program that prints three lines of text. HOMEWORK

Thinking in Java (http: //www. mindviewinc. com/Books/downloads. h tml) – Bruce Eckel Richard G Baldwin’s “IntroductoryThinking in Java (http: //www. mindviewinc. com/Books/downloads. h tml) – Bruce Eckel Richard G Baldwin’s “Introductory Java Programming Tutorial” on: http: //www. dickbaldwin. com/tocint. htm REFERENCES

QUESTIONS? QUESTIONS?