SlideShare une entreprise Scribd logo
1  sur  18
Télécharger pour lire hors ligne
Java	
  Programming	
  	
  
Unit	
  1	
  
Your	
  first	
  Java	
  Program	
  
Eclipse	
  IDE	
  

(c)	
  Yakov	
  Fain	
  2014	
  
	
  
During	
  this	
  training	
  
course	
  we’ll	
  use	
  the	
  
textbook	
  	
  
“Java	
  Programming	
  24-­‐
Hour	
  Trainer”	
  
by	
  Yakov	
  Fain.	
  	
  

(c)	
  Yakov	
  Fain	
  2014	
  	
  
Why	
  Learn	
  Java?	
  
•  Large	
  code	
  base	
  of	
  already	
  wriRen	
  applicaSons	
  
•  9	
  million	
  of	
  professional	
  Java	
  developers	
  
•  Lots	
  of	
  enterprise	
  applicaSons	
  were	
  developed	
  and	
  are	
  
being	
  developed	
  in	
  Java	
  
•  As	
  per	
  Tiobe	
  index	
  hRp://bit.ly/rItE	
  Java	
  remains	
  	
  one	
  of	
  
the	
  most	
  popular	
  languages.	
  
•  The	
  same	
  program	
  can	
  run	
  on	
  different	
  plaYorms	
  
•  Mobile	
  Android	
  development	
  is	
  done	
  in	
  Java	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
JDK	
  and	
  JRE	
  
•  Java	
  Development	
  Kit	
  (JDK)	
  is	
  required	
  to	
  develop	
  
and	
  run	
  programs	
  
	
  
•  Java	
  RunSme	
  Environment	
  (JRE)	
  is	
  required	
  to	
  run	
  
programs.	
  	
  
	
  
•  Users	
  must	
  have	
  JRE	
  installed,	
  developers	
  –	
  JDK	
  
	
  
•  JDK	
  includes	
  JRE	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Java	
  SE	
  and	
  Java	
  EE	
  
•  Java	
  SE:	
  Java	
  Standard	
  EdiSon	
  
	
  	
  
•  Java	
  EE:	
  Java	
  Enterprise	
  EdiSon	
  (formerly	
  J2EE)	
  
	
  
•  Java	
  EE	
  includes	
  a	
  set	
  of	
  technologies	
  built	
  on	
  top	
  
of	
  Java	
  SE:	
  Servlets,	
  JSP,	
  JSF,	
  EJB,	
  JMS,	
  et	
  al.	
  
	
  
•  All	
  Java	
  programs	
  run	
  inside	
  the	
  Java	
  Virtual	
  
Machine	
  (JVM)	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Installing	
  JDK	
  on	
  Windows	
  

Just	
  press	
  the	
  buRons	
  Next	
  or	
  ConSnue	
  to	
  complete	
  the	
  install.	
  	
  
The	
  at	
  the	
  end,	
  JavaFX	
  2	
  will	
  	
  be	
  also	
  installed,	
  which	
  won’t	
  be	
  covered	
  in	
  this	
  training.	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
TesSng	
  the	
  installaSon	
  
•  Add	
  the	
  bin	
  folder	
  to	
  the	
  PATH	
  system	
  
variable	
  of	
  your	
  computer	
  (for	
  details	
  see	
  
hRp://java.com/en/download/help/path.xml).	
  
	
  	
  
•  Make	
  sure	
  that	
  the	
  newly	
  installed	
  version	
  is	
  
being	
  used.	
  Open	
  Command	
  (or	
  Terminal	
  on	
  
MAC)	
  window	
  and	
  type	
  the	
  following:	
  
	
  
java	
  -­‐version	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Walkthrough	
  1	
  
1.  Download	
  Java	
  SE	
  7	
  (Currently	
  JDK	
  7	
  u51	
  –	
  update	
  51	
  from	
  
hRp://www.oracle.com/technetwork/java/javase/downloads	
  	
  
	
  	
  
	
  	
  	
  	
  	
  	
  	
  Download	
  JDK,	
  not	
  JRE.	
  In	
  Windows,	
  download	
  the	
  X86	
  version	
  of	
  Java.	
  
	
  
2.	
  Install	
  Java	
  SE	
  (for	
  details,	
  see	
  Lesson	
  1	
  of	
  the	
  textbook).	
  
	
  
	
  To	
  install	
  Java	
  SE	
  7	
  on	
  MAC	
  computers	
  download	
  the	
  JDK	
  dmg	
  file	
  from	
  
hRp://jdk7.java.net/download.html	
  ,	
  run	
  it	
  and	
  follow	
  the	
  instrucSons.	
  	
  
	
  
3.	
  If	
  amer	
  typing	
  	
  java	
  –version	
  in	
  the	
  Command	
  window	
  (Terminal	
  window	
  on	
  
MAC	
  OS)-­‐	
  	
  the	
  reported	
  version	
  should	
  be	
  1.7….	
  If	
  not,	
  you	
  may	
  need	
  to	
  modify	
  
the	
  system	
  variable	
  PATH	
  to	
  include	
  the	
  bin	
  directory	
  of	
  JDK.	
  
	
  	
  
JDK	
  8	
  will	
  be	
  released	
  in	
  March	
  of	
  2014.	
  
	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Three	
  steps	
  to	
  run	
  the	
  Java	
  program	
  	
  
•  Write	
  the	
  program	
  and	
  save	
  it	
  in	
  a	
  file	
  with	
  the	
  
name	
  that	
  ends	
  with	
  .java,	
  for	
  example	
  
HelloWorld.java	
  
	
  
•  Compile	
  the	
  program	
  using	
  javac	
  compiler,	
  e.g.	
  
javac	
  HelloWorld.java	
  
	
  
This	
  will	
  create	
  a	
  file	
  HelloWorld.class	
  
	
  
•  Run	
  your	
  program:	
  	
  
java	
  HelloWorld	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Compiling	
  and	
  running	
  HelloWorld	
  

(c)	
  Yakov	
  Fain	
  2014	
  	
  
HelloWorld.java	
  
public class HelloWorld {!
 !
public static void main(String[] args){
System.out.println(“Hello World”);!
}!
}!

	
  
In	
  Java,	
  you	
  start	
  with	
  creaSng	
  a	
  class.	
  Our	
  class	
  is	
  called	
  HelloWorld.	
  
	
  
A	
  class	
  can	
  have	
  methods.	
  In	
  this	
  case	
  it’s	
  called	
  main()	
  
	
  
You	
  can	
  run	
  the	
  class	
  as	
  a	
  program	
  if	
  it	
  has	
  a	
  method	
  with	
  the	
  following	
  signature	
  
	
  	
  
public static void main(String[] args)!
	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  

!
Walkthrough	
  2	
  
•  Create	
  a	
  directory	
  called	
  Prac-calJava	
  and	
  a	
  
subdirectory	
  Lesson1.	
  
	
  
•  Open	
  a	
  plain	
  text	
  editor,	
  e.g.	
  Notepad,	
  	
  enter	
  the	
  text	
  
of	
  the	
  HelloWorld	
  program	
  from	
  previous	
  slidw	
  and	
  
save	
  it	
  as	
  HelloWorld.java	
  in	
  the	
  directory	
  Lesson1.	
  
	
  
•  Open	
  the	
  command	
  window,	
  change	
  the	
  directory	
  to	
  
Lesson1	
  using	
  the	
  	
  cd	
  command.	
  
	
  
•  Compile	
  (javac)	
  and	
  run	
  (java)	
  HelloWorld	
  program	
  –	
  it	
  
has	
  to	
  print	
  HelloWorld	
  on	
  the	
  screen.	
  	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Eclipse	
  IDE	
  
•  Integrated	
  Development	
  Environment	
  (IDE)	
  
makes	
  your	
  work	
  more	
  producSve	
  
	
  
•  Includes	
  text	
  editor,	
  compiler,	
  debugger,	
  context-­‐
sensiSve	
  help,	
  works	
  with	
  different	
  Java	
  SDKs	
  
	
  
•  Eclipse	
  is	
  the	
  most	
  widely	
  used	
  IDE	
  
	
  
•  AlternaSves:	
  IntelliJ	
  IDEA	
  (JetBrains),	
  NetBeans	
  
(Oracle)	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Eclipse	
  IDE	
  
•  Eclipse	
  for	
  Java	
  EE	
  Developers	
  comes	
  with	
  a	
  
number	
  of	
  plugins	
  that	
  will	
  be	
  used	
  in	
  second	
  
half	
  of	
  this	
  course.	
  
	
  
•  The	
  latest	
  version	
  of	
  Eclipse	
  IDE	
  is	
  called	
  Kepler.	
  
	
  
•  Eclipse	
  is	
  also	
  a	
  plaYorm	
  for	
  plugin	
  development	
  	
  
–	
  addiSonal	
  features	
  simplifying	
  programming.	
  

(c)	
  Yakov	
  Fain	
  2014	
  	
  
Walkthrough	
  3	
  
•  Download	
  and	
  install	
  the	
  latest	
  	
  Eclipse	
  for	
  Java	
  EE	
  	
  (32	
  Bit	
  version)	
  
from	
  hRp://www.eclipse.org/downloads.	
  	
  
	
  
To	
  install	
  Eclipse	
  simply	
  unzip	
  the	
  content	
  of	
  the	
  archive	
  file	
  you	
  
downloaded.	
  	
  To	
  start	
  Eclipse,	
  double-­‐click	
  on	
  Eclipse.exe	
  (or	
  
Eclipse.app	
  on	
  MAC).	
  	
  
	
  
•  Create	
  a	
  new	
  Java	
  project	
  named	
  Hello	
  by	
  using	
  the	
  menu	
  File	
  |	
  
New	
  (see	
  Lesson	
  2	
  in	
  the	
  textbook	
  for	
  details).	
  
	
  
•  Create	
  a	
  new	
  Java	
  class	
  named	
  HelloWorld	
  and	
  enter	
  the	
  code	
  from	
  
LisSng	
  1-­‐1	
  of	
  the	
  textbook.	
  
	
  
•  Press	
  Control-­‐S	
  to	
  save	
  and	
  compile	
  the	
  code	
  
.	
  
•  Run	
  the	
  program	
  –	
  right-­‐click	
  on	
  HelloWorld	
  and	
  select	
  the	
  Run	
  As	
  
menu	
  item.	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
Homework	
  
1.	
  Write	
  a	
  program	
  that	
  will	
  print	
  your	
  name	
  and	
  address	
  in	
  the	
  Console	
  view	
  of	
  
Eclipse,	
  for	
  example:	
  
Alex	
  Johnson	
  
23	
  Main	
  Street	
  
import	
  java.uSl.Scanner;	
  
New	
  York,	
  NY	
  10001	
  
	
  
public	
  class	
  FriendsAndFamily	
  {	
  
USA	
  
	
  public	
  staSc	
  void	
  main(String[]	
  args)	
  {	
  
	
  
	
  
	
  	
  
2.	
  Study	
  all	
  materials	
  from	
  	
  
	
  Scanner	
  input=	
  new	
  Scanner(System.in);	
  
	
  
	
  	
  
Lesson	
  1	
  and	
  2	
  from	
  the	
  textbook	
  
	
  do	
  {	
  
	
  
	
  
	
  System.out.println("n	
  Enter	
  list	
  price:	
  "	
  );	
  
	
  
	
  double	
  listPrice	
  =	
  input.nextDouble();	
  	
  
3.	
  Create	
  a	
  new	
  project	
  in	
  Eclipse	
  
	
  
	
  	
  
	
  	
  	
  	
  	
  called	
  Sale	
  
	
  
	
  System.out.println("	
  Enter	
  discount	
  %:	
  "	
  );	
  
	
  
	
  
	
  int	
  discount	
  =	
  input.nextInt();	
  	
  
4.	
  Enter,	
  compile,	
  and	
  run	
  the	
  	
  
	
  
	
  	
  
	
  
	
  System.out.prinY("	
  You'll	
  pay	
  only	
  	
  $%2.2f",	
  listPrice	
  –	
  	
  
program	
  FriendsAndFamily.	
  Try	
  to	
  	
  
guess,	
  how	
  this	
  program	
  works.	
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  listPrice*discount/100);	
  
	
  
	
  
	
  	
  
	
  
	
  	
  	
  	
  }	
  while	
  (true);	
  	
  
	
  }	
  
5.	
  Study	
  Eclipse	
  tutorial	
  at	
  	
  
}	
  
hRp://bit.ly/EJSCx	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  
AddiSonal	
  Read	
  
•  How	
  to	
  study	
  online	
  (the	
  original,	
  in	
  Russian):	
  
hRp://www.stratoplan.ru/lib/break-­‐the-­‐ice/	
  	
  
	
  
The	
  English	
  translaSon	
  done	
  by	
  Google	
  
Translate:	
  hRp://bit.ly/10LXgrH	
  	
  	
  
	
  
•  Eclipse	
  IDE	
  Workbench	
  User	
  Guide:	
  
hRp://help.eclipse.org/kepler/index.jsp	
  	
  
(c)	
  Yakov	
  Fain	
  2014	
  	
  

Contenu connexe

Tendances

Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Yakov Fain
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training Patrick Schroeder
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkCodemotion
 
Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Yakov Fain
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDISven Ruppert
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppKaty Slemon
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introductionSagar Verma
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSShekhar Gulati
 
Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까장현 한
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in ReactTalentica Software
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next FrameworkCommit University
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersOswald Campesato
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersPaweł Żurowski
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-StartNaveen Pete
 
Angular js 2
Angular js 2Angular js 2
Angular js 2Ran Wahle
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideMek Srunyu Stittri
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 

Tendances (20)

Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2Reactive Thinking in Java with RxJava2
Reactive Thinking in Java with RxJava2
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
Tech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new frameworkTech Webinar: Angular 2, Introduction to a new framework
Tech Webinar: Angular 2, Introduction to a new framework
 
Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020Type script for_java_dev_jul_2020
Type script for_java_dev_jul_2020
 
React native
React nativeReact native
React native
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 
Springboot introduction
Springboot introductionSpringboot introduction
Springboot introduction
 
Developing Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJSDeveloping Modern Java Web Applications with Java EE 7 and AngularJS
Developing Modern Java Web Applications with Java EE 7 and AngularJS
 
Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까Angular 2 어디까지 왔을까
Angular 2 어디까지 왔을까
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
Angular 2 - The Next Framework
Angular 2 - The Next FrameworkAngular 2 - The Next Framework
Angular 2 - The Next Framework
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Angular1x and Angular 2 for Beginners
Angular1x and Angular 2 for BeginnersAngular1x and Angular 2 for Beginners
Angular1x and Angular 2 for Beginners
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
 
Express: A Jump-Start
Express: A Jump-StartExpress: A Jump-Start
Express: A Jump-Start
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 

Similaire à Java Intro: Unit1. Hello World

Similaire à Java Intro: Unit1. Hello World (20)

Compiling With Eclipse
Compiling With EclipseCompiling With Eclipse
Compiling With Eclipse
 
Java part 1
Java part 1Java part 1
Java part 1
 
JF_4_1_sg.pdf
JF_4_1_sg.pdfJF_4_1_sg.pdf
JF_4_1_sg.pdf
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
Android programming-basics
Android programming-basicsAndroid programming-basics
Android programming-basics
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
 
Introduction to java technology
Introduction to java technologyIntroduction to java technology
Introduction to java technology
 
B.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: AppetB.Sc. III(VI Sem) Advance Java Unit2: Appet
B.Sc. III(VI Sem) Advance Java Unit2: Appet
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 
109842496 jni
109842496 jni109842496 jni
109842496 jni
 
Supplement J Eclipse
Supplement J EclipseSupplement J Eclipse
Supplement J Eclipse
 
Java introduction
Java introductionJava introduction
Java introduction
 
Jsf tutorial
Jsf tutorialJsf tutorial
Jsf tutorial
 
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code baseSingle Sourcing RAP and RCP - Desktop and web clients from a single code base
Single Sourcing RAP and RCP - Desktop and web clients from a single code base
 
Unit2 java
Unit2 javaUnit2 java
Unit2 java
 
lab1.ppt
lab1.pptlab1.ppt
lab1.ppt
 
Java For beginners and CSIT and IT students
Java  For beginners and CSIT and IT studentsJava  For beginners and CSIT and IT students
Java For beginners and CSIT and IT students
 
Java interview question
Java interview questionJava interview question
Java interview question
 
Core java introduction
Core java introduction Core java introduction
Core java introduction
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
 

Plus de Yakov Fain

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in AngularYakov Fain
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java DevelopersYakov Fain
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2Yakov Fain
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java DevelopersYakov Fain
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2Yakov Fain
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developersYakov Fain
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in JavaYakov Fain
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework Yakov Fain
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTYakov Fain
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowYakov Fain
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web ApplicationYakov Fain
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual CompanyYakov Fain
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_githubYakov Fain
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software DeveloperYakov Fain
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developerYakov Fain
 

Plus de Yakov Fain (15)

Web sockets in Angular
Web sockets in AngularWeb sockets in Angular
Web sockets in Angular
 
TypeScript for Java Developers
TypeScript for Java DevelopersTypeScript for Java Developers
TypeScript for Java Developers
 
Reactive Streams and RxJava2
Reactive Streams and RxJava2Reactive Streams and RxJava2
Reactive Streams and RxJava2
 
Angular 4 for Java Developers
Angular 4 for Java DevelopersAngular 4 for Java Developers
Angular 4 for Java Developers
 
Reactive programming in Angular 2
Reactive programming in Angular 2Reactive programming in Angular 2
Reactive programming in Angular 2
 
Angular2 Development for Java developers
Angular2 Development for Java developersAngular2 Development for Java developers
Angular2 Development for Java developers
 
Reactive Thinking in Java
Reactive Thinking in JavaReactive Thinking in Java
Reactive Thinking in Java
 
Overview of the AngularJS framework
Overview of the AngularJS framework Overview of the AngularJS framework
Overview of the AngularJS framework
 
RESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoTRESTful services and OAUTH protocol in IoT
RESTful services and OAUTH protocol in IoT
 
Integrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business WorkflowIntegrating consumers IoT devices into Business Workflow
Integrating consumers IoT devices into Business Workflow
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Running a Virtual Company
Running a Virtual CompanyRunning a Virtual Company
Running a Virtual Company
 
Princeton jug git_github
Princeton jug git_githubPrinceton jug git_github
Princeton jug git_github
 
Surviving as a Professional Software Developer
Surviving as a Professional Software DeveloperSurviving as a Professional Software Developer
Surviving as a Professional Software Developer
 
Becoming a professional software developer
Becoming a professional software developerBecoming a professional software developer
Becoming a professional software developer
 

Dernier

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dashnarutouzumaki53779
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesSanjay Willie
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 

Dernier (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Visualising and forecasting stocks using Dash
Visualising and forecasting stocks using DashVisualising and forecasting stocks using Dash
Visualising and forecasting stocks using Dash
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 

Java Intro: Unit1. Hello World

  • 1. Java  Programming     Unit  1   Your  first  Java  Program   Eclipse  IDE   (c)  Yakov  Fain  2014    
  • 2. During  this  training   course  we’ll  use  the   textbook     “Java  Programming  24-­‐ Hour  Trainer”   by  Yakov  Fain.     (c)  Yakov  Fain  2014    
  • 3. Why  Learn  Java?   •  Large  code  base  of  already  wriRen  applicaSons   •  9  million  of  professional  Java  developers   •  Lots  of  enterprise  applicaSons  were  developed  and  are   being  developed  in  Java   •  As  per  Tiobe  index  hRp://bit.ly/rItE  Java  remains    one  of   the  most  popular  languages.   •  The  same  program  can  run  on  different  plaYorms   •  Mobile  Android  development  is  done  in  Java   (c)  Yakov  Fain  2014    
  • 4. JDK  and  JRE   •  Java  Development  Kit  (JDK)  is  required  to  develop   and  run  programs     •  Java  RunSme  Environment  (JRE)  is  required  to  run   programs.       •  Users  must  have  JRE  installed,  developers  –  JDK     •  JDK  includes  JRE   (c)  Yakov  Fain  2014    
  • 5. Java  SE  and  Java  EE   •  Java  SE:  Java  Standard  EdiSon       •  Java  EE:  Java  Enterprise  EdiSon  (formerly  J2EE)     •  Java  EE  includes  a  set  of  technologies  built  on  top   of  Java  SE:  Servlets,  JSP,  JSF,  EJB,  JMS,  et  al.     •  All  Java  programs  run  inside  the  Java  Virtual   Machine  (JVM)     (c)  Yakov  Fain  2014    
  • 6. Installing  JDK  on  Windows   Just  press  the  buRons  Next  or  ConSnue  to  complete  the  install.     The  at  the  end,  JavaFX  2  will    be  also  installed,  which  won’t  be  covered  in  this  training.   (c)  Yakov  Fain  2014    
  • 7. TesSng  the  installaSon   •  Add  the  bin  folder  to  the  PATH  system   variable  of  your  computer  (for  details  see   hRp://java.com/en/download/help/path.xml).       •  Make  sure  that  the  newly  installed  version  is   being  used.  Open  Command  (or  Terminal  on   MAC)  window  and  type  the  following:     java  -­‐version     (c)  Yakov  Fain  2014    
  • 8. Walkthrough  1   1.  Download  Java  SE  7  (Currently  JDK  7  u51  –  update  51  from   hRp://www.oracle.com/technetwork/java/javase/downloads                      Download  JDK,  not  JRE.  In  Windows,  download  the  X86  version  of  Java.     2.  Install  Java  SE  (for  details,  see  Lesson  1  of  the  textbook).      To  install  Java  SE  7  on  MAC  computers  download  the  JDK  dmg  file  from   hRp://jdk7.java.net/download.html  ,  run  it  and  follow  the  instrucSons.       3.  If  amer  typing    java  –version  in  the  Command  window  (Terminal  window  on   MAC  OS)-­‐    the  reported  version  should  be  1.7….  If  not,  you  may  need  to  modify   the  system  variable  PATH  to  include  the  bin  directory  of  JDK.       JDK  8  will  be  released  in  March  of  2014.     (c)  Yakov  Fain  2014    
  • 9. Three  steps  to  run  the  Java  program     •  Write  the  program  and  save  it  in  a  file  with  the   name  that  ends  with  .java,  for  example   HelloWorld.java     •  Compile  the  program  using  javac  compiler,  e.g.   javac  HelloWorld.java     This  will  create  a  file  HelloWorld.class     •  Run  your  program:     java  HelloWorld   (c)  Yakov  Fain  2014    
  • 10. Compiling  and  running  HelloWorld   (c)  Yakov  Fain  2014    
  • 11. HelloWorld.java   public class HelloWorld {!  ! public static void main(String[] args){ System.out.println(“Hello World”);! }! }!   In  Java,  you  start  with  creaSng  a  class.  Our  class  is  called  HelloWorld.     A  class  can  have  methods.  In  this  case  it’s  called  main()     You  can  run  the  class  as  a  program  if  it  has  a  method  with  the  following  signature       public static void main(String[] args)!     (c)  Yakov  Fain  2014     !
  • 12. Walkthrough  2   •  Create  a  directory  called  Prac-calJava  and  a   subdirectory  Lesson1.     •  Open  a  plain  text  editor,  e.g.  Notepad,    enter  the  text   of  the  HelloWorld  program  from  previous  slidw  and   save  it  as  HelloWorld.java  in  the  directory  Lesson1.     •  Open  the  command  window,  change  the  directory  to   Lesson1  using  the    cd  command.     •  Compile  (javac)  and  run  (java)  HelloWorld  program  –  it   has  to  print  HelloWorld  on  the  screen.       (c)  Yakov  Fain  2014    
  • 13. Eclipse  IDE   •  Integrated  Development  Environment  (IDE)   makes  your  work  more  producSve     •  Includes  text  editor,  compiler,  debugger,  context-­‐ sensiSve  help,  works  with  different  Java  SDKs     •  Eclipse  is  the  most  widely  used  IDE     •  AlternaSves:  IntelliJ  IDEA  (JetBrains),  NetBeans   (Oracle)   (c)  Yakov  Fain  2014    
  • 14. (c)  Yakov  Fain  2014    
  • 15. Eclipse  IDE   •  Eclipse  for  Java  EE  Developers  comes  with  a   number  of  plugins  that  will  be  used  in  second   half  of  this  course.     •  The  latest  version  of  Eclipse  IDE  is  called  Kepler.     •  Eclipse  is  also  a  plaYorm  for  plugin  development     –  addiSonal  features  simplifying  programming.   (c)  Yakov  Fain  2014    
  • 16. Walkthrough  3   •  Download  and  install  the  latest    Eclipse  for  Java  EE    (32  Bit  version)   from  hRp://www.eclipse.org/downloads.       To  install  Eclipse  simply  unzip  the  content  of  the  archive  file  you   downloaded.    To  start  Eclipse,  double-­‐click  on  Eclipse.exe  (or   Eclipse.app  on  MAC).       •  Create  a  new  Java  project  named  Hello  by  using  the  menu  File  |   New  (see  Lesson  2  in  the  textbook  for  details).     •  Create  a  new  Java  class  named  HelloWorld  and  enter  the  code  from   LisSng  1-­‐1  of  the  textbook.     •  Press  Control-­‐S  to  save  and  compile  the  code   .   •  Run  the  program  –  right-­‐click  on  HelloWorld  and  select  the  Run  As   menu  item.     (c)  Yakov  Fain  2014    
  • 17. Homework   1.  Write  a  program  that  will  print  your  name  and  address  in  the  Console  view  of   Eclipse,  for  example:   Alex  Johnson   23  Main  Street   import  java.uSl.Scanner;   New  York,  NY  10001     public  class  FriendsAndFamily  {   USA    public  staSc  void  main(String[]  args)  {           2.  Study  all  materials  from      Scanner  input=  new  Scanner(System.in);         Lesson  1  and  2  from  the  textbook    do  {        System.out.println("n  Enter  list  price:  "  );      double  listPrice  =  input.nextDouble();     3.  Create  a  new  project  in  Eclipse                  called  Sale      System.out.println("  Enter  discount  %:  "  );        int  discount  =  input.nextInt();     4.  Enter,  compile,  and  run  the              System.out.prinY("  You'll  pay  only    $%2.2f",  listPrice  –     program  FriendsAndFamily.  Try  to     guess,  how  this  program  works.                                                                                                                                                                listPrice*discount/100);                    }  while  (true);      }   5.  Study  Eclipse  tutorial  at     }   hRp://bit.ly/EJSCx     (c)  Yakov  Fain  2014    
  • 18. AddiSonal  Read   •  How  to  study  online  (the  original,  in  Russian):   hRp://www.stratoplan.ru/lib/break-­‐the-­‐ice/       The  English  translaSon  done  by  Google   Translate:  hRp://bit.ly/10LXgrH         •  Eclipse  IDE  Workbench  User  Guide:   hRp://help.eclipse.org/kepler/index.jsp     (c)  Yakov  Fain  2014