Aatul Palandurkar

Archive for the ‘Tutorials’ Category

via https://youtu.be/zLePmDzRKCo

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:


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

 

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/

Objective:

  • How to use For Each in Java?
  • How to use advance for in Java?
  • How to use advance for loop in Java Programming Language?
  • Types of For loop in Java

 

Source Code:


class ForEachExample
{
public static void main(String args[])
{
//declaring an array
int a[]={1,2,3,4,5,6};

// Old way
System.out.println("Old way");
for(int i=0; i<a.length;i++)
{
System.out.println(a[i]);
}

//New way: for-each loop
System.out.println("For each");
for(int i:a)
{
System.out.println(i);
}
}
}

 

Objective:

  • How to increase the engagement on your Instagram?
  • How to increase the engagement on your Facebook Page?
  • How to increase the engagement on your social media pages?

 

Do you want to increase the engagement on your social media such as Instagram or Facebook Page?

If yes, make sure you do these steps every day:

  1. Reply to your comments
  2. engage on your newsfeed
  3. Comment on Hashtags
  4. Post a minimum of 3 posts or stories every day
  5. Like your followers’ photos

 


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 13,221 other followers

Tweets

YouTube

Archives

%d bloggers like this: