Big Data and Hadoop Training: Java Programming Hands On

878 Views

Slide 1: Java Programming Hands-on

Hello and welcome to lesson number eight on Hadoop training offered by Simplilearn. In this lesson we will try to do some practical exercises in order to brush up our java programming skills.

Slide 2: Agenda

Here we will discuss some useful java programs and unit test program to test our java programming skills.

We will start with our first java program in the next slide.

Slide 3: Java Program – Swapping Two Integers

Let us try to create a program in java to swap two integers. Also, in the program, we need to create a user-defined class.

Slide 4: Executable Code – Swapping Two Integers

Here we create a user-defined class SwapNumbers which contains swap method (represented by the word swap with a pair of brackets in java programming syntax).

On line number seven, we create a scanner class object. On line number eight, and nine, we take inputs using Scanner class and assign it on x, and y variable.

On line number fourteen, we create a user-defined class (i.e. SwapNumbers).In this class, we use temp (t-e-m-p) as a third variable. On line number seventeen, we create a method (i.e. swap method), which actually swaps two variables. 

On the next slide we will discuss another java program.

Slide 5: Java Program – Extracting a Substring

Let us now try to create a program in java to extract a substring without the first five characters from a given string.

Slide 6: Executable Code – Extracting a Substring

We use substring method to extract from a string (represented by the word substring with a pair of brackets in Java programming syntax).

On line number ten, we assign “hello simplilearn” on str (s-t-r) . On the next line, we use substring method and pass 5 as a parameter to discard first five characters and re-assign on str (s-t-r). On line twelve, we print it on console.


{{detail.h1_tag}}

{{detail.display_name}}
{{author.author_name}} {{author.author_name}}

{{author.author_name}}

{{detail.full_name}}

Published on {{detail.created_at| date}} {{detail.duration}}

  • {{detail.date}}
  • Views {{detail.downloads}}
  • {{detail.time}} {{detail.time_zone_code}}

Registrants:{{detail.downloads}}

Downloaded:{{detail.downloads}}

About the {{detail.about_title && detail.about_title != null ? detail.about_title : 'On-Demand Webinar'}}

About the {{detail.about_title && detail.about_title != null ? detail.about_title : 'Webinar'}}

Hosted By

Profile

{{author.author_name}}

{{author.author_name}}

{{author.about_author}}

About the {{detail.about_title && detail.about_title != null ? detail.about_title : 'Ebook' }}

About the {{detail.about_title && detail.about_title != null ? detail.about_title : 'Ebook' }}

View {{detail.about_title && detail.about_title != null ? detail.about_title : 'On-Demand Webinar'}}

Webcast

Register Now!

Download the {{detail.about_title && detail.about_title != null ? detail.about_title : 'Ebook'}}!

First Name*
Last Name*
Email*
Company*
Phone Number*

View {{detail.about_title && detail.about_title != null ? detail.about_title : 'On-Demand Webinar'}}

Webcast

Register Now!

{{detail.about_title && detail.about_title != null ? detail.about_title : 'Webinar'}} Expired

Download the {{detail.about_title && detail.about_title != null ? detail.about_title : 'Ebook'}}

Email
{{ queryPhoneCode }}
Phone Number

Show full article video

Name Date Place
{{classRoomData.Date}} {{classRoomData.Place}} View Details

About the Author

{{detail.author_biography}}

About the Author

{{author.about_author}}