Java Training Videos

Passing String in Switch Case in Java

Objectives:

  • How to use switch case in Java?
  • How to use switch case with string in Java?
  • How to pass string literals in switch case in Java?

 

Source Code:

[sourcecode lang=”java”]

public class SwitchWithStringExample

{
public static void main(String[] args)
{
String str = "two";
switch(str)
{
case "one":
System.out.println("one");
break;
case "two":
System.out.println("two");
break;
case "three":
System.out.println("three");
break;
default:
System.out.println("no match");
} // switch close
} // main close
} // class close

[/sourcecode]

 

Steps to run above Java code:

Consider that we have saved code at C drive (c:\>) and the file is saved as SwitchWithStringExample.java

  1. Compilation : c:\> javac SwitchWithStringExample.java
  2. Interpretation : c:\> java SwitchWithStringExample

 

Output:

two

 

We conduct Java Training and Workshop for Corporates and College Students, if interested, please write to us on kloudsancyber@gmail.com

 

Aatul Palandurkar
International Trainer, and Author, NetBeans Dream Team Member

https://www.facebook.com/aatulpalandurkar
https://www.instagram.com/aatulpalandurkar/

Oracle Java Certifications For You

Oracle Java Certifications For You

The Java programming language is among the most widely used software development platforms in the IT industry nowadays. It is extensively being used and appreciated by individuals as well as organizations to transform their innovative ideas into working software solutions.

 

The Java programming language is among the most widely used software development platforms in the IT industry nowadays. It is extensively being used and appreciated by individuals as well as organizations to transform their innovative ideas into working software solutions.

 

Oracle Corporation is constantly working in the area of Java platform development. They provide Java certifications as well. Each of these java certifications verifies a certain level of expertise and knowledge of the Java platform belonging to specific domains.

 

Adding the best Java certification to your resume will help you grab the attention of the employer. A Java certification can validate your knowledge and expertise in working with Java. Preparing for a Java Certification can help you enhance your Java programming skills.

 

Oracle Java Certifications

 

Before diving in detail into the various Java certification courses offered by the Oracle Corporation, let’s first skim through a summarized introduction. Oracle Java certifications are categorized as follows:

 

Entry Level

  • Oracle Certified Associate Java Programmer (OCAJP)

 

Professional Level

  • Oracle Certified Professional Java Programmer (OCPJP)
  • Oracle Certified Professional Java Application Developer (OCPJAD)

 

Master/Architect Level

  • Oracle Certified Master Java Enterprise Architect (OCMJEA)

 

 

The Oracle OCP Java SE 8 Programmer I certification will validate your strong Java programming skills. To earn this certification you will have to pass the 1Z0-808 exam. The 1Z0-808 exam objectives include topics such as Java basics, Java data types, array, loop contracts, methods and encapsulation and so on.

 

 

 

The Oracle OCP Java SE 8 Programmer II certification is a professional-level certification designed to validate the foundation skills of database administration. The OCP 1Z0-809 exam objectives include exceptions and assertions; generics and collections; Java Class Design, Java File I/O (NIO.2), Java I/O Fundamentals, Java Stream API, and localization.

 

 

 

Oracle OCP Java SE 11 Developer certification covers a wide range of available Java 11 programming concepts. To earn this certification you will have to clear the 1Z0-815 exam. The Oracle 1Z0-815 exam covers topics such as Encapsulation, creating and using methods; creating simple Java programs, describing and using objects and classes; handling exceptions, Java technology, reusing implementations through Inheritance, 

understanding modules, and more.

As we all know that Java is employed for developing a wide array of applications. This programming language is used in creating server-side applications to mobile applications. So, if you are thinking about starting your career in this field, then you must consider these certifications. We offer courses that will help you prepare for the certification exams.

 

Java Program to Convert Binary to Decimal

Objectives :

  • Binary to Decimal Conversion
  • Converting Binary to Decimal
  • Write a program to convert binary to decimal
  • Write a program to convert binary number to decimal format
  • Write a program to convert binary to decimal using Scanner class
  • Write a program to convert binary to decimal, take input using Scanner class

Java Program :

[sourcecode lang=”java”]

import java.util.Scanner;

public class BinaryToDecimal {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter binary number: ");
String binary = scanner.nextLine();
int decimal = binaryToDecimal(binary);
System.out.println("Decimal equivalent of "+ binary +" is "+ decimal);
}

private static int binaryToDecimal(String binary) {
final int base = 2;
int decimal = 0;
for (int i = 0; i < binary.length(); i++) {
if (binary.charAt(i) == ‘0’) {
decimal += 0 * Math.pow(base, binary.length() – i – 1);
} else if (binary.charAt(i) == ‘1’) {
decimal += 1 * Math.pow(base, binary.length() – i – 1);
} else {
System.out.println("Invalid Binary Number");
System.out.println("Binary Number Contains only 0’s or 1’s");
System.exit(0);
}
}
return decimal;
}
}

[/sourcecode]

Output :
Enter binary number: 1110
Decimal equivalent of 1110 is 14

Why Java is Platform Independent?

Objectives :

  • Why Java is platform independent?
  • How java program executes?
  • What is execution flow of Java Program?
  • What are the steps to execute a Java Program?
  • What are the steps to run a Java Program?

[gigya src=”http://player.videofy.me/player.swf?videoId=424278″ width=”480″ height=”300″ quality=”high” wmode=”transparent” allowFullScreen=”true” ]