Advertisements

Aatul Palandurkar

Posts Tagged ‘Corporate Training for Java

Pattern 3 :

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

 

Java Code for above pattern :


import java.util.Scanner;

 

public class Pattern3

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

//Taking rows value from the user

System.out.println("How many rows you want in this pattern?");

int rows = sc.nextInt();

System.out.println("Here is your pattern....!!!");

//Printing upper half of the pattern

for (int i = 1; i <= rows; i++)

{

for (int j = 1; j <= i; j++)

{

System.out.print(j+" ");

}

System.out.println();

}

//Printing lower half of the pattern

for (int i = rows-1; i >= 1; i--)

{

for (int j = 1; j <= i; j++)

{

System.out.print(j+" ");

}

System.out.println();

}

//Closing the resources

sc.close();

}

}

Output :

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1

 

Advertisements

Pattern 2 :

1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

Java Program for the above pattern:


import java.util.Scanner;



public class MainClass

{

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);



//Taking rows value from the user
System.out.println("How many rows you want in this pattern?");



int rows = sc.nextInt();



System.out.println("Here is your pattern....!!!");



for (int i = 1; i <= rows; i++)

{

for (int j = 1; j <= i; j++)

{

System.out.print(i+" ");

}



System.out.println();

}



//Close the resources
sc.close();

}

}

CDAC-GTU-BISAG WIMC Batch

BISAG-CDAC-GTU WIMC Batch

Conducted Java Training at CDAC for M.Tech. students at Bhaskaracharya Institute of Space Applications and Geo-Informatics (BISAG), Info City, Gandhinagar, Gujrat under Gujrat Technical University (GTU). Seen a great collaboration between BISAG, CDAC and GTU, never seen such program for students where are students getting chance to work on research projects and all.

During the training covered Java, Java EE, Struts, Hibernate, Spring, EJB, RMI, Networking, etc. all in 5 days daily 8 hours. It helps a lot to cover that much if you use NetBeans for training Java and other Java related technologies like JavaEE, Struts, Hibernate, Spring, HTML5, etc. Students were good.

I feel honored after receiving Diwali Gift and Dinner party from students. I would also like to thanks them for Akshardham visit and really love the fountain and water show at Akshardham. There are only 4 water shows like that all over the world. I really enjoyed a lot guys thanks a lot. And I would like to share the thing that you are doing for physically and mentally challenged people, I have never seen this from students.

Free Source Code

Free Source Code

Objective :

* How to get the MAC Address of a computer?
* How to get the MAC Address of a computer using Java?
* How to get the MAC Address of a computer via programming?

import java.net.*;

class GetMac
{
public static void main(String arg[])
{
try
{
InetAddress address = InetAddress.getLocalHost();
NetworkInterface nwi = NetworkInterface.getByInetAddress(address);
byte mac[] = nwi.getHardwareAddress();
System.out.println(mac);
}
catch(Exception e)
{
System.out.println(e);
}
}
}

Note : This code will return only the first net address; if you need other detils too, get a list.

Posted from WordPress for Android

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?

Advertisements

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

Join 14,095 other followers

Tweets

YouTube

Archives

Advertisements
%d bloggers like this: