Introduction to Java The Java Platform, The Java Language, JDK, Eclipse Svetlin Nakov Technical Trainer Software University

Slides:



Advertisements
Similar presentations
Introduction to Java The objectives of this chapter are: To describe the key aspects of Java To describe the Java software development kit (SDK) To explain.
Advertisements

Introduction to Java Programming, 4E
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.
CMSC 202 Computer Science II for Majors Fall 2009 Introduction.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 1
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
Creating and Running Your First C# Program Telerik Software Academy Telerik School Academy.
JavaScript Basics Course Introduction SoftUni Team Technical Trainers Software University
Software Quality Assurance QA Engineering, Testing, Bug Tracking, Test Automation Software University Technical Trainers SoftUni Team.
Introduction to Programming
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
CMSC 202 Computer Science II for Majors Object-Oriented Programming.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Software University Curriculum, Courses, Exams, Jobs SoftUni Team Technical Trainers Software University
PHP Basics Course Introduction SoftUni Team Technical Trainers Software University
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Advanced JavaScript Course Introduction SoftUni Team Technical Trainers Software University
Project Tracking Tools Trello, Asana, Basecamp, GitHub Issue Tracker, TRAC SoftUni Team Technical Trainers Software University
Programming Basics Course Introduction SoftUni Team Technical Trainers Software University
Software Testing Lifecycle Exit Criteria Evaluation, Continuous Integration Ivan Yonkov Technical Trainer Software University.
Teamwork and Personal Skills Course Introduction Software University SoftUni Team Technical Trainers.
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Jaeki Song ISQS6337 JAVA Lecture 03 Introduction to Java -The First Java Application-
Introduction to Java Programming with Forte Y. Daniel Liang.
Course Program, Evaluation, Exams
Svetlin Nakov Technical Trainer Software University
Build Processes and Continuous Integration Automating Build Processes Software University Technical Trainers SoftUni Team.
Session 1 Introduction to Java. Objectives Java Simplified / Session 1 / 2 of 32 Explain the history of Java Explain Java in brief List the types of Java.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Test-Driven Development Learn the "Test First" Approach to Coding SoftUni Team Technical Trainers Software University
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
JavaScript Basics Course Introduction Svetlin Nakov Technical Trainer Software University
Trainers Team Ivan Yonkov Rated in the top 7% at Stack Overflow
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
C# Basics Course Introduction Svetlin Nakov Technical Trainer Software University
Web Fundamentals (HTML and CSS) Course Introduction SoftUni Team Technical Trainers Software University
Jekyll Static Site Generator Template-Based Site Generation Svetlin Nakov Technical Trainer Software University
The Java Platform, The Java Language, JDK, IntelliJ
Web Fundamentals (HTML and CSS) Course Introduction Svetlin Nakov Technical Trainer Software University
Web Development Tools Tools for Front-End Developers Writing HTML and CSS Code SoftUni Team Technical Trainers Software University
Web Fundamentals (HTML and CSS)
introductory lecture on java programming
High-Quality Code: Course Introduction Course Introduction SoftUni Team Technical Trainers Software University
Advanced C# Course Introduction SoftUni Team Technical Trainers Software University
Object-Oriented Programming Course Introduction Svetlin Nakov Technical Trainer Software University
Reflection Programming under the hood SoftUni Team Technical Trainers Software University
JavaScript Applications Course Introduction SoftUni Team Technical Trainers Software University
Mocking with Moq Tools for Easier Unit Testing SoftUni Team Technical Trainers Software University
Data Structures Curriculum, Trainers, Evaluation, Exams SoftUni Team Technical Trainers Software University
Mocking with Moq Mocking tools for easier unit testing Svetlin Nakov Technical Trainer Software University
ITP 109 Week 2 Trina Gregory Introduction to Java.
JavaScript Tools Tools for Writing / Editing / Debugging JavaScript Code Svetlin Nakov Technical Trainer Software University
Programming for Beginners Course Introduction SoftUni Team Technical Trainers Software University
JavaScript Applications Course Introduction SoftUni Team Technical Trainers Software University
PHP Basics Course Introduction Svetlin Nakov Technical Trainer Software University
Introduction to JAVA Programming
Software Technologies Course Overview SoftUni Team Technical Trainers Software University
Programming Fundamentals Course Introduction SoftUni Team Technical Trainers Software University
Doctrine The PHP ORM SoftUni Team Technical Trainers Software University
CMSC 202 Computer Science II for Majors Fall 2010 Introduction Version 9/101.
Advanced JavaScript Course Introduction SoftUni Team Technical Trainers Software University
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
Java OOP Advanced Course Introduction SoftUni Team Technical Trainers Software University
Setup a PHP + MySQL Development Environment
آشنایی با جاوا Introduction to Java
Outcome of the Lecture Upon completion of this lecture you will be able to understand Fundamentals and Characteristics of Java Language Basic Terminology.
Presentation transcript:

Introduction to Java The Java Platform, The Java Language, JDK, Eclipse Svetlin Nakov Technical Trainer Software University

Table of Contents 1.Your First Java Program 2.The Java Language 3.The Java Platform and JVM 4.JDK – Java SE Development Kit  Using javac and java from the command line 5.Java IDEs 6.Java Documentation 2

3  The "Java Basics" course is NOT for absolute beginners  Take the "C# Basics" course at SoftUni first:  The course is for beginners, but with previous coding skills  Requirements  Coding skills – entry level  Computer English – entry level  Logical thinking Warning: Not for Absolute Beginners

Your First Java Program Writing and Running Java Code in Eclipse

A sample Java program: public class HelloJava { public static void main(String[] args) { public static void main(String[] args) { System.out.println("Hello Java!"); System.out.println("Hello Java!"); }} 5

public class HelloJava { public static void main(String[] args) { public static void main(String[] args) { System.out.println("Hello Java!"); System.out.println("Hello Java!"); }} Java Code – How It Works? 6 Define a class " HelloJava " Define the main(…) method – the program entry point Print a text on the console by calling the method " println " of the class " System "

7 Formatting Java Code public class HelloJava { public static void main(String[] args) { System.out.println("Hello Java!"); } The block after the { symbol is indented right by a TAB. The } symbol stays under the block holding the {. Class names in Java are in PascalCase. The { symbol stays at the same line. Method names in Java are in camelCase.

File Names Should Match Class Names!  In Java all public classes should stay in a file with the same name  For example, the class HelloJava should be in the file HelloJava.java HelloJava.java public class HelloJava { public static void main(String args[]) { public static void main(String args[]) { System.out.println("Hello Java!"); System.out.println("Hello Java!"); }}

Your First Java Program Live Demo

10  Java is very popular programming language  A syntax to describe computer programs  Object-oriented, statically typed, similar to C#  Easy to learn, easy to read, easy to understand  Java is a development platform  Java SE, Java EE, JavaFX, Java ME, Android  Runs compiled Java code in a virtual machine (JVM)  Runs on millions of devices, in any OS What is "Java"?

The Java Programming Language

12  Java programming language  High-level object-oriented general purpose language  Statically typed (not dynamic like JavaScript)  Type-safe (runs in a virtual machine, called JVM)  Easy to learn, easy to read, easy to understand  Good for large server-side projects  Similar to C# and C++, but less capable  Highly portable (write once, run everywhere) The Java Programming Language

The Java Platform Java, JVM, JDK

14  Environment for execution of Java code  JVM (Java Virtual Machine)  Java programming language  Powerful class library (Java API) and programing model  Ability to run Java programs on any machine with JVM  Windows, Linux, MacOS, Android, your TV, your car,...  Java Platform Editions  Java SE, Java EE, Android, Java ME, Java Card, Java Embedded, … The Java Platform

15  Java 1.0a2 (1995) – started as platform for Java applets  JDK 1.0 (1996) – Java language, JDK, JVM, standard API classes  JDK 1.1 (1997) – AWT UI framework, JavaBeans, JDBC  J2SE 1.2 (1998) – J2SE, J2EE, J2ME, Swing UI framework, collections  J2SE 1.3 (2000) – HotSpot JVM, JavaSound, JNDI  J2SE 1.4 (2002) – Java Web Start, JAXP, regular expressions  J2SE 5.0 (2004) – generics, varargs, foreach, autoboxing, enums  Java SE 6 (2006) – GUI improvements, JVM improvements, open-source  Oracle buys Sun (2009) – Java becomes more open  Java SE 7 (2011) – dynamic languages, new I/O, try-with-resources  Java SE 8 (2014) – lambda expressions, streams API, JavaFX UI framework The Java Platform – History

16  JVM – Java Virtual Machine  Executes compiled Java bytecode (compiled programs)  Virtual environment for safe code execution  Similar to CLR in.NET  JRE – Java Runtime Environment  A runtime environment for Java-based software  Similar to.NET Framework  JRE = JVM + Java API classes (standard Java libraries)  Available for Windows, Linux, Mac OS X (no Android and iOS version) Java Platform: Terminology

17  JDK – Java Development Kit (Java SDK)  The development platform for Java developers  Consists of JRE (JVM + API classes) + compilers + tools  Available for several OS: Windows, Linux, Mac OS X  Note that Android SDK is not type of JDK (it is separate platform)  Class file (.class file)  A compiled Java code (or Python / Groovy / other language code)  Holds Java bytecode + metadata  Usually multiple class files are packed into a JAR archive Java Platform: Terminology (2)

18  JAR archive (.jar files)  JAR archives hold a set of classes and resources  Like the assemblies in.NET Framework (.dll files)  JAR files are ZIP archives with files + manifest (metadata XML)  Classpath  A set of directories and JAR archives holding your application's classes and resources (e.g. images, icons, sounds, etc.)  When loading a class or resource, the JVM traverses the classpath to find the requested classes or files Java Platform: Terminology (2)

Java Compilation and Execution public class HelloJava { public static void public static void main(String args[]) { main(String args[]) { System.out.println( System.out.println( "Hello Java!"); "Hello Java!"); }} (source code) Compilation ( javac ) CAFE BABE 6D61 696E B4C 6A F6C 616E 672F E67 3B A F6C 616E 672F D 0C F C6A F 696F 2F E D 3B C48 656C 6C6F 2C20 4A61 (bytecode) Execution ( java ) JVM HelloJava.javaHelloJava.class

20 Cross-Platform Java  Cross-platform compilation and execution  Java / Python code .class /.jar files  execution in the JVM  JVM runs on many devices  Bytecode is portable by nature

Console-Based Compilation and Execution of Java Code Live Demo (in Linux and Windows) 21

22  Java SE (Java Standard Edition)  For standalone Java applications and Java applets  Java EE (Java Enterprise Edition)  For server-side, enterprise, Web applications and Web services  A set of APIs and server specifications built on top of Java SE  Java ME (Java Micro Edition)  A pared down version of Java SE and API’s for embedded devices  Android  Android is Java-like platform for Android tablets and smartphones Java Platform Editions

23 Java SE 8 Platform * Learn more at

24  In Java the classes usually stay in packages (like namespaces in C#)  A package holds a set of classes and other (inner) packages  Packages are included by " import package.subpackage.* "  Project directory structure always follows the package structure Packages in Java src/org/softuni/main/Main.java package org.softuni.main; import org.softuni.data; public class Main { … } src/org/softuni/data/Student.java package org.softuni.data; public class Student { … }

25  A JAR file holds a set of classes and resources  Folders follow the package structure of the classes  JAR files are ZIP archives  Created by Eclipse or by a console tool called " jar " Creating a JAR File jar -cf archive.jar jar -cf archive.jar

Creating a JAR File and Configuring the Classpath Live Demo

27  A programming language  Java, C#, PHP, Python, …  Task to solve: project description  Development platform: IDE, compilers, SDK  IDE (Eclipse, NetBeans, Visual Studio), Java SDK, Android SDK  Set of standard classes (class library)  Java API classes /.NET API classes / PHP standard functions  Help documentation  Java API documentation /.NET API documentation What You Need to Program?

Java IDEs Eclipse, NetBeans, IntelliJ IDEA

29  Eclipse is popular IDE (Integrated Development Environment)  For many languages: Java, PHP, Python, JavaScript, HTML, CSS, …  Eclipse is IDE that helps us to:  Write code  Design user interface  Compile code  Execute / test / debug code  Browse the help  Manage project's files Eclipse – IDE for Java Developers

30  Eclipse is a single tool for:  Writing code in many languages (Java, PHP, C++, JavaScript…)  Using different technologies (Web, mobile, embedded, …)  Complete integration of most development activities  Coding, compiling, running, testing, debugging, UI design, deployment, version control,...  Free and open-source –  Easy to use and intuitive Benefits of Eclipse

Eclipse IDE Creating, Compiling, Running and Debugging Java Programs – Live Demo

 NetBeans is an open-source IDE for Java developers  Supports Java, C++, PHP, HTML5  Developed by Oracle (formerly by Sun Microsystems)  Written in Java, runs on Windows, Linux, Mac OS X  Supports the latest Java SE and Java EE technologies  Integrated features: code editor, debugger, profiler, GUI editor, source control tools, etc.  NetBeans

Live Demo

 IntelliJ IDEA is а powerful IDE for Java developers  Very good usability, helps you a lot with writing code  Supports Java, PHP, Python, Ruby, HTML5, SQL  The free edition support only Java and basic features  Advanced features, PHP, Python, Ruby, SQL, Java EE, Android, etc. are commercial  Written in Java, runs on Windows, Linux, Mac OS X  IntelliJ IDEA

Live Demo

Java Documentation

37  Java 8 API Documentation   Complete documentation of all classes and their functionality  With descriptions of all methods, properties, events, etc.  Java 8 official documentation:   The Java Tutorial  Java Documentation

Java API Documentation Live Demo

39  The Java platform consists of  The Java language  Java Virtual Machine  Java API classes  One Java platform, several editions  Java SE, Java EE, Java ME, Android  JDK = JRE + compilers and tools  Eclipse – powerful open-source Java IDE Summary

? ? ? ? ? ? ? ? ? Introduction to Java

License  This course (slides, examples, demos, videos, homework, etc.) is licensed under the "Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International" licenseCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International  Attribution: this work may contain portions from  "Fundamentals of Computer Programming with Java" book by Svetlin Nakov & Co. under CC-BY-SA licenseFundamentals of Computer Programming with JavaCC-BY-SA  "C# Basics" course by Software University under CC-BY-NC-SA licenseC# BasicsCC-BY-NC-SA 41

SoftUni Diamond Partners

Free Software University  Software University Foundation – softuni.orgsoftuni.org  Software University – High-Quality Education, Profession and Job for Software Developers  softuni.bg softuni.bg  Software Facebook  facebook.com/SoftwareUniversity facebook.com/SoftwareUniversity  Software YouTube  youtube.com/SoftwareUniversity youtube.com/SoftwareUniversity  Software University Forums – forum.softuni.bgforum.softuni.bg