Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Java Data Analysis

You're reading from   Java Data Analysis Data mining, big data analysis, NoSQL, and data visualization

Arrow left icon
Product type Paperback
Published in Sep 2017
Publisher Packt
ISBN-13 9781787285651
Length 412 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
John R. Hubbard John R. Hubbard
Author Profile Icon John R. Hubbard
John R. Hubbard
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Java Data Analysis
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Introduction to Data Analysis FREE CHAPTER 2. Data Preprocessing 3. Data Visualization 4. Statistics 5. Relational Databases 6. Regression Analysis 7. Classification Analysis 8. Cluster Analysis 9. Recommender Systems 10. NoSQL Databases 11. Big Data Analysis with Java Java Tools Index

Java


Java has been, for at least a decade now, the most popular programming language. Nearly all the software described in this appendix is itself written in Java.

Java was developed in the early 1990s by a team of software researchers, led by James Gosling. It was released by Sun Microsystems in 1995 and was maintained by that company until it was acquired by Oracle in 2010.

Java comes pre-installed on the Mac. To update it, open System Preferences and click on the Java icon at the bottom of the panel. This brings up the Java Control Panel. The About… button under the General tab will display the current version of Java that is installed. As of August, 2017, that should be Version 8. The Update tab allows for updates.

Java can be run from the command line or from within an Integrated Development Environment (IDE). To do the former, you will need a text editor to write your code. On the Mac, you can use the TextEdit app. The four-line Hello World program is shown in a TextEdit window in Figure A-5.

Figure A-5. The Hello World program in Java

Note that, for this to compile, the quotation marks must be flat (like this " "), not smart (like this " "). To get that right, open the Preferences panel in TextEdit and de-select Smart Quotes. Also note that the TextEdit's default file types, RTF and TXT, must be overridden—Java source code must be saved in a file whose name is the same as the public class and whose type is .java.

We saved the source code in our hub/demos/ folder. The shell session in Figure A-6 appears as follows:

Figure A-6. Running the Hello World program

From this, we can learn:

  • How to display the source code with the cat command

  • How to compile the source code with the javac command

  • How to run the program with the java command

The javac command creates the class file, Hello.class, which we then execute with the java command, thus generating the expected output.

The Echo program in Figure A-7 illustrates the use of command line arguments.

Figure A-7. Reading command line arguments

The program prints each element of its args[] array. In the run shown here, there are four of them, entered on the command line immediately after the name of the program.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Banner background image