Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Java Fundamentals
Java Fundamentals

Java Fundamentals: A fast-paced and pragmatic introduction to one of the world's most popular programming languages

Arrow left icon
Profile Icon Gazihan Alankus Profile Icon Isola Profile Icon Miles Obare Profile Icon Basheer Ahamed Fazal Profile Icon Rogério Theodoro de Brito +1 more Show less
Arrow right icon
€24.99
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1 (1 Ratings)
Paperback Mar 2019 408 pages 1st Edition
eBook
€13.98 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Gazihan Alankus Profile Icon Isola Profile Icon Miles Obare Profile Icon Basheer Ahamed Fazal Profile Icon Rogério Theodoro de Brito +1 more Show less
Arrow right icon
€24.99
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1 (1 Ratings)
Paperback Mar 2019 408 pages 1st Edition
eBook
€13.98 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€13.98 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Java Fundamentals

Chapter 1. Introduction to Java

Note

Learning Objectives

By the end of this lesson, you'll be able to:

  • Describe the working of the Java ecosystem

  • Write simple Java programs

  • Read input from the users

  • Utilize classes in the java.util package

Introduction


In this first lesson, we are embarking on our study of Java. If you are coming to Java from a background of working with another programming language, you probably know that Java is a language for programming computers. But Java goes beyond just that. It's more than a very popular and successful language that is virtually present everywhere, it is a collection of technologies. Besides the language, it encompasses a very rich ecosystem and it has a vibrant community working on many facets to make the ecosystem as dynamic as it can be.

The Java Ecosystem


The three most basic parts of the Java ecosystem are the Java Virtual Machine (JVM), the Java Runtime Environment (JRE), and the Java Development Kit (JDK), which are stock parts that are supplied by Java implementations.

Figure 1.1: A representation of the Java ecosystem

Every Java program runs under the control of a JVM. Every time you run a Java program, an instance of JVM is created. It provides security and isolation for the Java program that is running. It prevents the running of the code from clashing with other programs within the system. It works like a non-strict sandbox, making it safe to serve resources, even in hostile environments such as the internet, but allowing interoperability with the computer on which it runs. In simpler terms, JVM acts as a computer inside a computer, which is meant specifically for running Java programs.

Note

It is common for servers to have many JVMs in execution simultaneously.

Up in the hierarchy of stock Java technologies is the JRE. The JRE is a collection of programs that contains the JVM and also many libraries/class files that are needed for the execution of programs on the JVM (via the java command). It includes all the base Java classes (the runtime) as well as the libraries for interaction with the host system (such as font management, communication with the graphical system, the ability to play sounds, and plugins for the execution of Java applets in the browser) and utilities (such as the Nashorn JavaScript interpreter and the keytool cryptographic manipulation tool). As stated before, the JRE includes the JVM.

At the top layer of stock Java technologies is the JDK. The JDK contains all the programs that are needed to develop Java programs, and it's most important part is the Java Compiler (javac). The JDK also includes many auxiliary tools such as a Java disassembler (javap), a utility to create packages of Java applications (jar), system to generate documentation from source code (javadoc), among many other utilities. The JDK is a superset of the JRE, meaning that if you have the JDK, then you also have the JRE (and the JVM).

But those three parts are not the entirety of Java. The ecosystem of Java includes a very large participation of the community, which is one of the reasons for the popularity of the platform.

Note

Research into the most popular Java libraries that are used by the top Java projects on GitHub (according to research that has been repeated in 2016 and 2017) showed that JUnit, Mockito, Google's Guava, logging libraries (log4j, sl4j), and all of Apache Commons (Commons IO, Commons Lang, Commons Math, and so on), marked their presence, together with libraries to connect to databases, libraries for data analysis and machine learning, distributed computing, and almost anything else that you can imagine. In other words, for almost any use that you want to write programs to, there are high chances of an existing library of tools to help you with your task.

Besides the numerous libraries that extend the functionality of the stock distributions of Java, there is a myriad of tools to automate builds (for example, Apache Ant, Apache Maven, and Gradle), automate tests, distribution and continuous integration/delivery programs (for example, Jenkins and Apache Continuum), and much, much more.

Our First Java Application


As we briefly hinted before, programs in Java are written in source code (which are plain text, human-readable files) that is processed by a compiler (in the case of Java, javac) to produce the Java bytecode in class files. The class files containing Java bytecode are, then, fed to a program called java, which contains the Java interpreter/JVM that executes the program that we wrote:

Figure 1.2: The process of compilation in Java

Syntax of a Simple Java Program

Like all programming languages, the source code in Java must follow particular syntaxes. Only then, will the program compile and provide accurate results. Since Java is an object-oriented programming language, everything in Java is enclosed within classes. A simple Java program looks similar to this:

public class Test { //line 1
    public static void main(String[] args) { //line 2
        System.out.println("Test"); //line 3
    } //line 4
} //line 5

Every java program file should have the same name as that of the class that contains main (). It is the entry point into the Java program.

Therefore the preceding program will compile and run without any errors only when these instructions are stored in a file called Test.java.

Another key feature of Java is that it is case-sensitive. This implies that System.out.Println will throw an error as it is not capitalized correctly. The correct instruction should be System.out.println.

main() should always be declared as shown in the sample. This is because, if main() is not a public method, it will not be accessed by the compiler, and the java program will not run. The reason main() is static is because we do not call it using any object, like you would for all other regular methods in Java.

Note

We will discuss these the public and static keywords later in this book, in greater depth.

Comments are used to provide some additional information. The Java compiler ignores these comments.

Single line comments are denoted by // and multiline comments are denoted by /* */.

Exercise 1: A Simple Hello World Program

  1. Right-click the src folder and select New | Class.

  2. Enter HelloWorld as the class name, and then click OK.

  3. Enter the following code within the class:

    public class HelloWorld{    
    public static void main(String[] args) {  // line 2
            System.out.println("Hello, world!");  // line 3
        }
    }
  4. Run the program by clicking on Run | Run 'Main'.

    The output of the program should be as follows:

    Hello World!

Exercise 2: A Simple Program for Performing Simple Mathematic Operations

  1. Right-click the src folder and select New | Class.

  2. Enter ArithmeticOperations as the class name, and then click OK.

  3. Replace the code inside this folder with the following code:

    public class ArithmeticOperations {
        public static void main(String[] args) {
                System.out.println(4 + 5);
                System.out.println(4 * 5);
                System.out.println(4 / 5);
                System.out.println(9 / 2);
        }
    }
  4. Run the main program.

    The output should be as follows:

    9
    20
    0
    4

    In Java, when you divide an integer (such as 4) by another integer (such as 5), the result is always an integer (unless you instruct the program otherwise). In the preceding case, do not be alarmed to see that 4 / 5 gives 0 as a result, since that's the quotient of 4 when divided by 5 (you can get the remainder of the division by using a % instead of the division bar).

    To get the result of 0.8, you would have to instruct the division to be a floating-point division instead of an integer division. You can do that with the following line:

    System.out.println(4.0 / 5);

    Yes, this does mean, like most programming languages, there is more than one type of number in Java.

Exercise 3: Displaying Non-ASCII Characters

  1. Right-click the src folder and select New | Class.

  2. Enter ArithmeticOperations as the class name, and then click OK.

  3. Replace the code in this folder with the following code:

    public class HelloNonASCIIWorld {
        public static void main(String[] args) {
                System.out.println("Non-ASCII characters: ☺");
                System.out.println("∀x ∈ ℝ: ⌈x⌉ = −⌊−x⌋");
                System.out.println("π ≅ " + 3.1415926535); // + is used to concatenate 
        }
    }
  4. Run the main program.

    The output for the program should be as follows:

    Non-ASCII characters: ☺
    ∀x ∈ ℝ: ⌈x⌉ = −⌊−x⌋
    π ≅ 3.1415926535

Activity 1: Printing the Results of Simple Arithmetic Operations

To write a java program that prints the sum and the product of any two values, perform the following steps:

  1. Create a new class.

  2. Within main(), print a sentence describing the operation on the values you will be performing along with the result.

  3. Run the main program. Your output should be similar to the following:

    The sum of 3 + 4 is 7
    The product of 3 + 4 is 12

    Note

    The solution for this activity can be found on page 304.

Getting Input from the User

We previously studied a program that created output. Now, we are, going to study a complementary program: a program that gets input from the user so that the program can work based on what the user gives the program:

import java.io.IOException; // line 1

public class ReadInput { // line 2
    public static void main(String[] args) throws IOException { // line 3
        System.out.println("Enter your first byte");
        int inByte = System.in.read(); // line 4
        System.out.println("The first byte that you typed: " + (char) inByte); // line 5
        System.out.printf("%s: %c.%n", "The first byte that you typed", inByte); // line 6
    } // line 7
} // line 8

Now, we must dissect the structure of our new program, the one with the public class ReadInput. You might notice that it has more lines and that it is apparently more complex, but fret not: every single detail will be revealed (in all its full, glorious depth) when the time is right. But, for now, a simpler explanation will do, since we don't want to lose our focus on the principal, which is taking input from the user.

First, on line 1, we use the import keyword, which we have not seen yet. All Java code is organized in a hierarchical fashion, with many packages (we will discuss packages in more detail later, including how to make your own).

Here, hierarchy means "organized like a tree", similar to a family tree. In line 1 of the program, the word import simply means that we will use methods or classes that are organized in the java.io.Exception package.

On line 2, we, as before, create a new public class called ReadInput, without any surprises. As expected, the source code of this program will have to be inside a source file called ReadInput.java.

On line 3, we start the definition of our main method, but, this time, add a few words after the closing parentheses. The new words are throws IOException. Why is this needed?

The short explanation is: "Because, otherwise, the program will not compile." A longer version of the explanation is "Because when we read the input from the user, there may be an error and the Java language forces us to tell the compiler about some errors that our program may encounter during execution."

Also, line 3 is the line that's responsible for the need of the import in line 1: the IOException is a special class that is under the java.io.Exception hierarchy.

Line 5 is where the real action begins: we define a variable called inByte (short for "byte that will be input"), which will contain the results of the System.in.read method.

The System.in.read method, when executed, will take the first byte (and only one) from the standard input (usually, the keyboard, as we already discussed) and give it back as the answer to those who executed it (in this case, we, in line 5). We store this result in the inByte variable and continue the execution of the program.

With line 6, we print (to the standard output) a message saying what byte we read, using the standard way of calling the System.out.println method.

Notice that, for the sake of printing the byte (and not the internal number that represents the character for the computer), we had to use a construct of the following form:

  • An open parenthesis

  • The word char

  • A closing parenthesis

We use this before the variable named inByte. This construct is called a type cast and will be explained in much more detail in the lessons that follow.

On line 7, we use a different way to print the same message to the standard output. This is meant to show you how many tasks may be accomplished in more than one way and that there is "no single correct" way. Here, we use the System.out.println function.

The remaining lines simply close the braces of the main method definition and that of the ReadInput class.

Some of the main format strings for System.out.printf are listed in the following table:

Table 1.1: Format strings and their meaning

There are many other formatting strings and many variables, and you can find the full specification on Oracle's website.

We will see some other common (modified) formatted strings, such as %.2f (which instructs the function to print a floating-point number with exactly two decimal digits after the decimal point, such as 2.57 or -123.45) and %03d (which instructs the function to print an integer with at least three places possibly left filled with 0s, such as 001 or 123 or 27204).

Exercise 4: Reading Values from the User and Performing Operations

To read two numbers from the user and print their product, perform the following steps:

  1. Right-click the src folder and select New | Class.

  2. Enter ProductOfNos as the class name, and then click OK.

  3. Import the java.io.IOException package:

    import java.io.IOException;
  4. Enter the following code within the main() to read integers:

    public class ProductOfNos{
    public static void main(String[] args){
    System.out.println("Enter the first number");
    int var1 = Integer.parseInt(System.console().readLine());
    System.out.println("Enter the Second number");
    int var2 = Integer.parseInt(System.console().readLine());
  5. Enter the following code to display the product of the two variables:

    System.out.printf("The product of the two numbers is %d", (var1 * var2));
    }
    }
  6. Run the program. You should see an output similar to this:

    Enter the first number
    10
    Enter the Second number
    20
    The product of the two numbers is 200

Well done, this is your first Java program.

Packages


Packages are namespaces in Java that can be used to avoid name collisions when you have more than one class with the same name.

For example, we might have more than one class named Student being developed by Sam and another class with the same name being developed by David. We need a way to differentiate between the two classes if we need to use them in our code. We use packages to put the two classes in two different namespaces.

For example, we might have the two classes in two packages:

  • sam.Student

  • david.Student

The two packages look as follows in File Explorer:

Figure 1.3: Screenshot of the sam.Student and david.Student packages in File Explorer

All the classes that are fundamental to the Java language belong to the java.lang package. All the classes that contain utility classes in Java, such as collections, classes for localization, and time utilities, belong to the java.util package.

As a programmer, you can create and use your own packages.

Rules to Follow When Using Packages

Here are a few rules to be considered while using packages:

  • Packages are written in lowercase

  • To avoid name conflicts, the package name should be the reverse domain of the company. For example, if the company domain is example.com, then the package name should be com.example. So, if we have a Student class in that package, the class can be accessed with com.example.Student.

  • Package names should correspond to folder names. For the preceding example, the folder structure would be as follows:

    Figure 1.4: Screenshot of the folder structure in File Explorer

To use a class from a package in your code, you need to import the class at the top of your Java file. For example, to use the Student class, you would import it as follows:

import com.example.Student;
public class MyClass {

}

Scanner is a useful class in the java.util package. It is an easy way of inputting types, such as int or strings. As we saw in an earlier exercise, the packages use nextInt() to input an integer with the following syntax:

sc = new Scanner(System.in);
int x =  sc.nextIn()

Activity 2: Reading Values from the User and Performing Operations Using the Scanner Class

To read two numbers from the user and print their sum, perform the following steps:

  1. Create a new class and enter ReadScanner as the class name

  2. Import the java.util.Scanner package

  3. In the main() use System.out.print to ask the user to enter two numbers of variables a and b.

  4. Use System.out.println to output the sum of the two numbers.

  5. Run the main program.

    The output should be similar to this:

    Enter a number: 12
    Enter 2nd number: 23
    The sum is 35.  

Note

The solution for this activity can be found on page 304.

Activity 3: Calculating the Percent Increase or Decrease of Financial Instruments

Users expect to see the daily percentage of increase or decrease of financial instruments such as stocks and foreign currency. We will ask the user for the stock symbol, the value of the stock on day 1, the value of the same stock on day 2, calculate the percent change and print it in a nicely formatted way. To achieve this, perform the following steps:

  1. Create a new class and enter StockChangeCalculator as the class name

  2. Import the java.util.Scanner package:

  3. In the main() use System.out.print to ask the user for the symbol of the stock, followed by the day1 and day2 values of the stock.

  4. Calculate the percentChange value.

  5. Use System.out.println to output the symbol and the percent change with two decimal digits.

  6. Run the main program.

    The output should be similar to:

    Enter the stock symbol: AAPL
    Enter AAPL's day 1 value: 100
    Enter AAPL's day 2 value: 91.5
    AAPL has changed -8.50% in one day.

    Note

    The solution for this activity can be found on page 305.

Summary


This lesson covered the very basics of Java. We saw some of the basic features of a Java program, and how we can display or print messages to the console. We also saw how we can read values using the input consoles. We also looked at packages that can be used to group classes, and saw an example of Scanner in java.util package.

In the next lesson, we will cover more about how values are stored, and the different values that we can use in a Java program.

Left arrow icon Right arrow icon

Key benefits

  • Get introduced to Java, its features, and its ecosystem
  • Understand how Java uses object-oriented programming
  • Become an expert Java exception handler

Description

Since its inception, Java has stormed the programming world. Its features and functionalities provide developers with the tools needed to write robust cross-platform applications. Java Fundamentals introduces you to these tools and functionalities that will enable you to create Java programs. The book begins with an introduction to the language, its philosophy, and evolution over time, until the latest release. You'll learn how the javac/java tools work and what Java packages are - the way a Java program is usually organized. Once you are comfortable with this, you'll be introduced to advanced concepts of the language, such as control flow keywords. You'll explore object-oriented programming and the part it plays in making Java what it is. In the concluding chapters, you'll get to grips with classes, typecasting, and interfaces, and understand the use of data structures, arrays, strings, handling exceptions, and creating generics. By the end of this book, you will have learned to write programs, automate tasks, and follow advanced courses on algorithms and data structures or explore more advanced Java courses.

Who is this book for?

Java Fundamentals is designed for tech enthusiasts who are familiar with some programming languages and want a quick introduction to the most important principles of Java.

What you will learn

  • Create and run Java programs
  • Use data types, data structures, and control flow in your code
  • Implement best practices while creating objects
  • Work with constructors and inheritance
  • Understand advanced data structures to organize and store data
  • Employ generics for stronger check-types during compilation
  • Learn to handle exceptions in your code
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 15, 2019
Length: 408 pages
Edition : 1st
Language : English
ISBN-13 : 9781789801736
Vendor :
Oracle
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

Product Details

Publication date : Mar 15, 2019
Length: 408 pages
Edition : 1st
Language : English
ISBN-13 : 9781789801736
Vendor :
Oracle
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 86.97
Mastering Microservices with Java
€36.99
Java 11 and 12 ??? New Features
€24.99
Java Fundamentals
€24.99
Total 86.97 Stars icon
Banner background image

Table of Contents

9 Chapters
Introduction to Java Chevron down icon Chevron up icon
Variables, Data Types, and Operators Chevron down icon Chevron up icon
Control Flow Chevron down icon Chevron up icon
Object-Oriented Programming Chevron down icon Chevron up icon
OOP in Depth Chevron down icon Chevron up icon
Data Structures, Arrays, and Strings Chevron down icon Chevron up icon
The Java Collections Framework and Generics Chevron down icon Chevron up icon
Advanced Data Structures in Java Chevron down icon Chevron up icon
Exception Handling Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
(1 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 100%
Mr. Matthew J. Barnard Jul 03, 2021
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
This book is incredibly cheaply made. The fonts are terrible, with severe printing problems on the code example font, where they are unreadable. There has clearly been zero quality control and care taken on the production of the book. I feel sorry for the author.At this price, I was expecting something close O'Reilly quality in terms of print. I'm shocked that it's not even usable. I'm returning the book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela