Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Wednesday, 27 May 2020

Wondering how a Java Program Executes???

We’ll see how it executes but first let’s get to know how a C program executes. And then we'll compare it with how java program executes. From the above diagram, we can see that C executes faster than Java as it has fewer steps to execute. In java, we have an extra step that is Compiler converts the source file to byte code (This is where platform independency is achieved). Then JVM converts byte code to machine language and is fed to the processor to get output.


Applications are of two types:
Embedded applications
Portable applications

Embedded applications:

An embedded application is software that is placed permanently inside some kind of device to perform a very specific set of functions. The program instructions for embedded systems are called firmware, or embedded software, and are stored in read-only memory, or flash memory chips. For embedded applications Speed is a very important factor.

Portable applications:

A portable application(portable app), sometimes also called standalone, is a program designed to read and write its configuration settings into an accessible folder in the computer, usually in the folder where the portable application can be found. This makes it easier to transfer the program with the user's preferences and data between different computers. A program that doesn't have any configuration options can also be a portable application. Portable applications can be stored on any data storage device, or in other words, these applications are platform-independent.

Object Orientation

Before going ahead with the object orientation. Let’s get to know what is orientation? Orientation ➤Perspective ➤Way of looking at something
 Let us take an example of a glass of water and try to understand in a better way: 
A chemist will see the glass of water as liquid + gas, an optimistic person will look at it as half-full glass, a pessimistic person will see it as a half-empty glass, a realist will see itas glass of water, a drunkard will see it as maybe..alcohol??? but a developer will view it as an object. 

Object Orientation is the way of looking at this world as a collection of objects. In this world, no object is completely useless. All objects are in constant interaction with each other. No object exists in isolation. Every object belongs to a type. Where type does not exist but the objects of the type exist in reality. Every object has two parts:
1.“has” part refers to the properties/state of an object. To take care of has a part in Java we make use of Datatypes.
2.“does” part refers to the behavior of an object. To take care of does part in java we use of methods or functions.

Platform Dependency

One of the most important features of java is platform independency and to understand how java achieved platform indecency, one must learn what is platform dependency. Let us understand what is a platform to understand platform dependency. Platform is a combination of hardware and software. Hardware mainly refers to microprocessors and software refers to the Operating system. For example, the platform in your computer could be the combination of i5 processor and windowsOS or it could be i9 processor and mac OS as shown below. However, from the software engineers perspective, platform only refers to OS.
Platform=Hardware + Software.
After getting to know what is platform let us now understand platform dependency by considering different cases of C language which is very much platform-independent.

we considered a file of C  programming language as the extension is  exmp.c.  Since  C  programming language is platform dependent programming language,  its platform of execution and platform of compilation must be the same.  In the above case the platform of compilation and platform of execution is the same which is windows operating system and hence we got the output.

we again considered the file of C programming language as the extension is exmp.c. In this case, we considered two computers having the same operating system connected via LAN connection. If we now take a copy of MLL(Machine Level Language) file from first computer and try to execute it on the second computer, according to you will the file execute????

 Compilation Phase  Execution Phase
 Windows windows
If in case you are still confused, just check two phases. COMPILATION PHASE    EXECUTION PHASE Windows   Windows If you can refer the above table, compilation happened on windows and execution happened on windows. Since platform of compilation is the same as that of platform of execution,the file gets executed which simply means you will get the output.
This case is the same as that of case ii except the platform of the second computer that is C
 Compilation Phase  Execution Phase
 Windows UNIX
If you can refer the above table, compilation happened on windows and execution happened on UNIX. Since the platform of compilation is not same as that of platform of execution file will not get executed which simply means you will not get the output.

The  problem  faced  in  C  or  C++  programming language  is that their compiler directly converts High-level language code to machine level language codeand if this code is copied on other type of operating system and tried to execute, it doesn’t   work   because   the   code was   written   using   platform   dependent programming language.To reslove this issue, JAMES GOSLING, the inventor of java programming language which was platform-independent.

Let us now learn how java achieved platform independence

Let us assume you are writing code using java on your computer which has windows os. Since Machine understands machine-level code not your high-level code, the conversion must happens. Let us see how exactly conversion happens in java. Initially, your HLL code is given as input to the compiler but the java compiler will not give MLL code as output like c and c++ compiler rather it takes HLL as input and gives a special type of code as output called as byte code which is platform-independent. Byte code is neither HLL code nor MLL code, hence it is also referred to as intermediate code. If you can recollect machine understands only MLL code but java compiler gave you byte code. To resolve this,  James  Gosling provided software called JVM(Java virtual Machine)which was platform-dependent that is different OS have different JVM. Since you are writing code on windows OS, you will have to download windows compatible  JVM  .  JVM  will now convert  byte code to machine level code which machine can easily understand. In this way, java achieved platform independence using a special type  of code which is byte code.

Friday, 29 March 2019

Java 9 Modularity Revealed: Project Jigsaw and Scalable Java Applications by Alexandru Jecan (Author)

Develop modular applications using the Java Platform Module System, the single most anticipated feature in Java 9. You will improve maintainability and performance of your Java applications by deploying only modules that are needed and encapsulating their implementation details. 

Until now Java has been monolithic. Using any one part of Java has meant incorporating the entirety of the runtime environment, an approach ill-suited to the increasing number of IoT devices such as fitness monitors, kitchen appliances, toys and games, and so forth. This book shows a new way, to make Java scale from the smallest of footprints in the smallest of devices through desktop PCs and on up to server platforms. 

With Java 9 Modularity Revealed you will learn to make your projects more reliable and scalable than ever using the most important feature in Java 9―The Java Platform Module System, known more commonly as Project Jigs
aw. You will learn how to avoid one of the major pain points of Java programming, that of conflicting class names from different modules, or packages. You will learn to create custom run-time images that represent a minimal and more compact JRE containing only those modules that you need. You will further learn to migrate existing Java applications to modular ones using different approaches and tools. The end result is a new ability to plug together different modules without fear of namespace and other conflicts, and you can deploy to everything from small devices to large servers. 

This book provides code examples and explanations.

What You'll Learn 
  • Build Java applications using the new modular system introduced in Java 9 
  • Create your own JRE consisting only of the modules that you require 
  • Adapt your testing techniques toward modular applications
  • lare your dependencies on other modules 
  • Enable modules to export only specific packages 
  • Migrate existing Java applications to modular ones 
  • Improve maintainability and performance of Java applications

Who This Book Is For

Experienced Java programmers wanting to keep up and become informed on the new modularity support in Java 9
Buy :

PDF Download :

Tuesday, 26 March 2019

Java Language Features: With Modules, Streams, Threads, I/O, and Lambda Expressions 2nd Edition, by Kishori Sharan (Author)

Work with essential and advanced features of the Java programming language such as Java modules development, lambda expressions (closures), inner classes, threads, I/O, Collections, garbage collection, and more. Author Kishori Sharan provides over 50 diagrams and 290 complete programs to help you visualize and better understand the topics covered in this book.

Java Language Features, Second Edition starts with a series of chapters on the essential language features provided by Java, including annotations, reflection, and generics. These topics are then complemented by details of how to use lambda expressions, allowing you to build powerful and efficient Java programs. The chapter on threads follows this up and discusses everything from the very basic concepts of a thread to the most advanced topics such as synchronizers, the fork/join framework, and atomic variables.

This book contains unmatched coverage of Java NIO, the Stream API, the Path API, the FileVisitor API, the watch service, and asynchronous file I/O. With this in-depth knowledge, your data- and file-management programs will be able to take advantage of every feature of Java's powerful I/O framework and much more.

Additionally, three appendices are available for free via the Download Source Code on These appendices will give you a head start on the most important features of Java 10 and the new Java versioning scheme.

What You’ll Learn
  • Use essential and advanced features of the Java language
  • Code Java annotations and inner classes
  • Work with reflection, generics, and threads
  • Take advantage of the garbage collector
  • Manage streams with the Stream API

Who This Book Is For

Those new to Java programming and continues the learning Java journey; it is recommended that you read an introductory Java programming book first, such as Beginning Java Fundamentals, from Apress.
Buy :
PDF Download :

Wednesday, 20 March 2019

Modern Java Recipes: Simple Solutions to Difficult Problems in Java 8 and 9 Paperback – 2017 by Ken Kousen (Author)

The introduction of functional programming concepts in Java SE 8 was a drastic change for this venerable object-oriented language. Lambda expressions, method references and streams fundamentally changed the idioms of the language and many developers have been trying to catch up ever since. This cookbook will help. with more than 70 detailed recipes, author Ken Kousen shows you how to use the newest features of Java to solve a wide range of problems.
For developers comfortable with previous Java versions, this guide covers nearly all of Java SE 8 and includes a chapter focused on changes coming in Java 9. Need to understand how functional idioms will change the way you write code? This cookbookóchock full of use casesóis for you.
Recipes cover:

The basics of lambda expressions and method references
Interfaces in the java.util.function package
Stream operations for transforming and filtering data
Comparators and Collectors for sorting and converting streaming data
Combining lambdas, method references and streams
Creating instances and extract values from Javaís Optional type
New I/O capabilities that support functional streams
The Date-Time API that replaces the legacy Date and Calendar classes
Mechanisms for experimenting with concurrency and parallelism 

Buy :
Modern Java Recipes: Simple Solutions to Difficult Problems in Java 8 and 9 Paperback – 2017 by Ken Kousen (Author) 

PDF Download :

Modern Java Recipes: Simple Solutions to Difficult Problems in Java 8 and 9 Paperback – 2017 by Ken Kousen (Author)

Friday, 15 March 2019

Learn Java the Easy Way : A Hands-On Introduction to Programming Kindle Edition by Bryson Payne

Java is the world’s most popular programming language, but it’s known for having a steep learning curve. Learn Java the Easy Way takes the chore out of learning Java with hands-on projects that will get you building real, functioning apps right away.

You’ll start by familiarizing yourself with JShell, Java’s interactive command line shell that allows programmers to run single lines of code and get immediate feedback. Then, you’ll create a guessing game, a secret message encoder, and a multitouch bubble-drawing app for both desktop and mobile devices using Eclipse, an industry-standard IDE, and Android Studio, the development environment for making Android apps.

As you build these apps, you’ll learn how to:
-Perform calculations, manipulate text strings, and generate random colors
-Use conditions, loops, and methods to make your programs responsive and concise
-Create functions to reuse code and save time
-Build graphical user interface (GUI) elements, including buttons, menus, pop-ups, and sliders 
-Take advantage of Eclipse and Android Studio features to debug your code and find, fix, and prevent common mistakes

If you’ve been thinking about learning Java, Learn Java the Easy Way will bring you up to speed in no time.

Buy : 

Learn Java the Easy Way : A Hands-On Introduction to Programming 

PDF Download :

Learn Java the Easy Way : A Hands-On Introduction to Programming

Tuesday, 12 March 2019

Learning PHP, MySQL & JavaScript, 5th Edition With jQuery, CSS & HTML5 (Learning PHP, MYSQL, Javascript, CSS & HTML5)

Build interactive, data-driven websites with the potent combination of open-source technologies and web standards, even if you have only basic HTML knowledge. With this popular hands-on guide, you'll tackle dynamic web programming with the help of today's core technologies: PHP, MySQL, JavaScript, jQuery, CSS and HTML5.

Explore each technology separately, learn how to use them together and pick up valuable web programming practices along the way. At the end of the book, you'll put everything together to build a fully functional social networking site, using XAMPP or any development stack you choose.

  • Learn PHP in-depth, along with the basics of object-oriented programming
  • Explore MySQL, from database structure to complex queries
  • Use the MySQLi Extension, PHP's improved MySQL interface
  • Create dynamic PHP web pages that tailor themselves to the user
  • Manage cookies and sessions and maintain a high level of security
  • Master the JavaScript language-and enhance it with jQuery
  • Use Ajax calls for background browser/server communication
  • Acquire CSS2 and CSS3 skills for professionally styling your web pages
  • Implement all of the new HTML5 features, including geolocation, audio, video and the canvas
Buy :

Learning PHP, MySQL & JavaScript with j Query, CSS & HTML5 Paperback – 2015 by Robin Nixon  

PDF Download :

Learning PHP, MySQL & JavaScript with j Query, CSS & HTML5 Paperback – 2015 by Robin Nixon 

Java XML and JSON, 2nd Edition Document Processing for Java SE

Use this guide to master the XML metalanguage and JSON data format along with significant Java APIs for parsing and creating XML and JSON documents from the Java language. New in this edition is coverage of Jackson (a JSON processor for Java) and Oracle’s own Java API for JSON processing (JSON-P), which is a JSON processing API for Java EE that also can be used with Java SE. This new edition of Java XML and JSON also expands coverage of DOM and XSLT to include additional API content and useful examples.

All examples in this book have been tested under Java 11. In some cases, source code has been simplified to use Java 11’s var language feature. The first six chapters focus on XML along with the SAX, DOM, StAX, XPath, and XSLT APIs. The remaining six chapters focus on JSON along with the mJson, GSON, JsonPath, Jackson, and JSON-P APIs. Each chapter ends with select exercises designed to challenge your grasp of the chapter's content. An appendix provides the answers to these exercises.

What You'll Learn
  • Master the XML language
  • Create, validate, parse, and transform XML documents
  • Apply Java’s SAX, DOM, StAX, XPath, and XSLT APIs
  • Master the JSON format for serializing and transmitting data
  • Code against third-party APIs such as Jackson, mJson, Gson, JsonPath
  • Master Oracle’s JSON-P API in a Java SE context

Who This Book Is For

Intermediate and advanced Java programmers who are developing applications that must access data stored in XML or JSON documents. The book also targets developers wanting to understand the XML language and JSON data format.
Buy :
PDF Download :

Popular Posts


Android (21) AngularJS (1) Assembly Language (1) Books (10) C (75) C# (4) C++ (81) Data Strucures (4) Downloads (1) Engineering (13) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (87) Leet Code (4) PHP (20) Python (211) R (69) Selenium Webdriver (2) Software (14) SQL (27)