Introduction to programming learn to program in java with data structures, algorithms, and logic
Get a solid understanding of Java fundamentals to master programming through a series of practical steps About This Book Enjoy your first step into the world of programming Understand what a language is and use its features to build applications Learn about a wide variety of programming applications...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham ; Mumbai :
Packt
2018.
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009630632106719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Contributors
- Packt Upsell
- Table of Contents
- Preface
- Chapter 1: Java Virtual Machine (JVM) on Your Computer
- What is Java?
- Basic terms
- History and popularity
- Principles
- Java platforms, editions, versions, and technologies
- Platforms and editions
- Versions
- Technologies
- Java SE Development Kit (JDK) installation and configuration
- Where to start
- The page with Java installers
- How to install
- Main Java commands
- The JVM execution command
- The compilation command
- Command jcmd and other commands
- Exercise - JDK tools and utilities
- Answer
- Summary
- Chapter 2: Java Language Basics
- The basic terms of Java programming
- Byte code
- Defects (bugs) and their severity and priority
- Java program dependencies
- Statements
- Methods
- Classes
- The Main class and the main method
- Classes and objects (instances)
- Java classes
- Java object (class instance)
- Class (static) and object (instance) members
- Private and public
- Static members
- Object (instance) members
- Method overloading
- Interface, implementation, and inheritance
- Interface
- Implementation
- Inheritance
- The java.lang.Object class
- The equals() method
- The hashCode() method
- The getClass() method
- The toString() method
- The clone() method
- The wait() and notify() methods
- OOP concepts
- Object/class
- Encapsulation
- Inheritance
- Interface (abstraction)
- Polymorphism
- Exercise - Interface versus abstract class
- Answer
- Summary
- Chapter 3: Your Development Environment Setup
- What is the development environment?
- Java editor is your main tool
- Source code compilation
- Code sharing
- Code and test execution
- Setting the classpath
- Manual setting
- Searching on the classpath.
- IDE sets the classpath automatically
- There are many IDEs out there
- NetBeans
- Eclipse
- IntelliJ IDEA
- Installing and configuring IntelliJ IDEA
- Downloading and installing
- Configuring IntelliJ IDEA
- Exercise - Installing NetBeans IDE
- Answer
- Summary
- Chapter 4: Your First Java Project
- What is a project?
- Definition and origin of project
- Project-related terms
- A project's life cycle
- Creating a project
- Creating a project using a project wizard
- Maven project configuration
- Changing IDE settings at any time
- Writing an application code
- Java package declaration
- Creating a package
- Creating the MyApplication class
- Building the application
- Hiding some files and directories
- Creating the SimpleMath class
- Creating methods
- Executing and unit testing an application
- Executing the application using the IDE
- Creating a unit test
- Executing the unit test
- How many unit tests are enough?
- Exercise - JUnit @Before and @After annotations
- Answer
- Summary
- Chapter 5: Java Language Elements and Types
- What are the Java language elements?
- Input elements
- Types
- Comments
- Identifiers and variables
- Identifier
- Variable
- Variable declaration, definition, and initialization
- Final variable (constant)
- Reserved and restricted keywords
- Reserved keywords
- Restricted keywords
- Separators
- Semicolon "
- Braces "{}
- Parentheses "()
- Brackets "[]
- Comma ",
- Period ".
- Ellipsis "...
- Colons "::
- At sign "@
- Primitive types and literals
- The Boolean type
- Integral types
- Floating-point types
- Default values of primitive types
- Primitive type literals
- Reference types and String
- Class types
- Interface types
- Arrays
- Default value of a reference type
- Reference type literals
- String immutability
- Enum types.
- Passing reference type values as method parameters
- Exercise - Variable declarations and initializations
- Answer
- Summary
- Chapter 6: Interfaces, Classes, and Object Construction
- What is an API?
- Java APIs
- Command line APIs
- HTTP-based APIs
- Software component API
- Interface and object factory as API
- Interface
- Object factory
- Reading configuration file
- Using the json-simple library
- Using the json-api library
- Unit test
- Calculator API
- Adding static methods to API
- The API is complete
- Overloading, overriding, and hiding
- Interface method overloading
- Interface method overriding
- Interface static member hiding
- Class member hiding
- Instance method overriding
- Instance method overloading
- This, super, and constructors
- Keyword this and its usage
- Keyword super and its usage
- Constructors
- Final variable, final method, or final class
- Final variable
- Final method
- Final class
- Exercise - Restricting a class instantiation to a single shared instance
- Answer
- Summary
- Chapter 7: Packages and Accessibility (Visibility)
- What is importing?
- Structure of the .java file and packages
- Single class import
- Multiple classes import
- Static import
- Access modifiers
- The accessibility of a top-level class or interface
- Access to class or interface members
- The constructor's accessibility is the same as any class member
- Encapsulation
- Data hiding and decoupling
- Flexibility, maintainability, and refactoring
- Reusability
- Testability
- Exercise - Shadowing
- Answer
- Summary
- Chapter 8: Object-Oriented Design (OOD) Principles
- What is the purpose of design?
- The project's feasibility
- Requirement gathering and prototyping
- High-level design
- Detailed design
- Coding
- Testing
- A roadmap to a good design.
- Encapsulating and coding to an interface
- Taking advantage of polymorphism
- Decoupling as much as you can
- Preferring aggregation over inheritance
- So many OOD principles and so little time
- Exercise - Design patterns
- Answer
- Summary
- Chapter 9: Operators, Expressions, and Statements
- What are the core elements of Java programming?
- Operators
- Arithmetic unary (+ -) and binary operators: + - * / %
- Incrementing and decrementing unary operators: ++ --
- Equality operators: == !=
- Relational operators: <
- >
- <
- = >
- =
- Logical operators: ! &
- |
- Conditional operators: &
- &
- || ? : (ternary)
- Assignment operators (most popular): = += -= *= /= %=
- Instance creation operator: new
- Type comparison operator: instanceof
- Preferring polymorphism over the instanceof operator
- Field access or method invocation operator: .
- Cast operator: (target type)
- Expressions
- Statements
- Operator precedence and evaluation order of operands
- Operator precedence
- Evaluation order of operands
- Widening and narrowing reference types
- Widening
- Narrowing
- Widening and narrowing conversion of primitive types
- Widening
- Narrowing
- Methods of primitive type conversion
- Boxing and unboxing between primitive and reference types
- Boxing
- Unboxing
- Method equals() of reference types
- Using the implementation of the base class Object
- Overriding the equals() method
- Using the identification implemented in the parent class
- The equals() method of the String class
- The equals() method in wrapper classes of primitive types
- Exercise - Naming the statements
- Answer
- Summary
- Chapter 10: Control Flow Statements
- What is a control flow?
- Selection statements
- Iteration statements
- Branching statements.
- Exception handling statements
- Selection statements
- if
- if...else
- if...else if-...-else
- switch...case
- Iteration statements
- while
- do...while
- for
- for enhanced
- for with multiple initializers and expressions
- Branching statements
- Break and labeled break
- Continue and labeled continue
- return
- Exception handling statements
- throw
- try...catch
- Checked and unchecked (runtime) exceptions
- throws
- Custom exceptions
- What is exception handling?
- Some best practices of exception handling
- finally
- Assert requires JVM option -ea
- Exercise - Infinite loop
- Answer
- Summary
- Chapter 11: JVM Processes and Garbage Collection
- What are JVM processes?
- Loading
- Linking
- Initialization
- Instantiation
- Execution
- Garbage collection
- Application termination
- JVM architecture
- Runtime data areas
- Classloader
- Execution engine
- Threads
- Extending the Thread class
- What is daemon?
- Running threads extending Thread
- Implementing Runnable
- Runing threads implementing Runnable
- Extending Thread vs implementing Runnable
- How to execute the main(String[]) method
- Using IDE
- Command line with classes on classpath
- Command line with a .jar file on classpath
- Command line with an executable .jar file
- Garbage collection
- Responsiveness, throughput, and stop-the-world
- Object age and generations
- When stop-the-world is unavoidable
- Exercise - Monitoring JVM while running an application
- Answer
- Summary
- Chapter 12: Java Standard and External Libraries
- What are standard and external libraries?
- Java standard libraries
- java.lang
- java.util
- java.time
- java.io and java.nio
- java.sql and javax.sql
- java.net
- java.math
- java.awt, javax.swing, and javafx
- Java external libraries
- org.junit
- org.mockito.
- org.apache.log4j and org.slf4j.