ENTERPRISE

Java Tutorials : Nested For Loop (part 2) - Program to create a Two-Dimensional Array

3/27/2015 10:22:00 PM

3.Program to create a Two-Dimensional Array
 

public class twoDimArray
{
public static void main(String [] args)
{
String city[][]={ {"NewYork","Muscat","London"} , {"Cairo","Beijing","CapeTown"} };
for (int i=0; i<city.length; i++)
{
for (int j=0; j<city[i].length; j++)
{
System.out.print(city[i][j]+"\t");
}
System.out.println();
}}}

 

Java - Take For Loop Variables And Put Into 2 Separate Array


4.Program to create multiplication table
 

public class multiplicationTable
{
public static void main(String args[]){System.out.print(" ");
for (int i=1; i<=9; i++)System.out.print(" "+i);System.out.println();
System.out.println("-------------------------------------------------------");
for (int i=1; i<=9; i++){System.out.print(i+"|");
for (int j=1; j<=9; j++){if (i*j<10)System.out.print(" "+i*j);
elseSystem.out.print(" "+i*j);}System.out.println();
}}}
Other  
  •  How to use scanf in C.
  •  Dynamic Arrays: Using malloc() and realloc()
  •  Review : D-Link DSP-W215 mydlink Wi-Fi Smart Plug
  •  Review : Linksys EA9200 Tri-Band Smart Wi-Fi router
  •  Identity on Cisco Firewalls : Administrative Access Control on ASA
  •  Identity on Cisco Firewalls : Administrative Access Control on IOS
  •  Identity on Cisco Firewalls : User-Based Zone Policy Firewall (part 3) - Integrating Auth-Proxy and the ZFW
  •  Identity on Cisco Firewalls : User-Based Zone Policy Firewall (part 2) - Establishing user-group Membership Awareness in IOS - Method 2
  •  Identity on Cisco Firewalls : User-Based Zone Policy Firewall (part 1) - Establishing user-group Membership Awareness in IOS - Method 1
  •  Identity on Cisco Firewalls : IOS User-Level Control with Auth-Proxy (part 4) - Combining Classic IP Inspection (CBAC) and Auth-Proxy
  •  
    Top 10
    3 Tips for Maintaining Your Cell Phone Battery (part 2) - Discharge Smart, Use Smart
    3 Tips for Maintaining Your Cell Phone Battery (part 1) - Charge Smart
    OPEL MERIVA : Making a grand entrance
    FORD MONDEO 2.0 ECOBOOST : Modern Mondeo
    BMW 650i COUPE : Sexy retooling of BMW's 6-series
    BMW 120d; M135i - Finely tuned
    PHP Tutorials : Storing Images in MySQL with PHP (part 2) - Creating the HTML, Inserting the Image into MySQL
    PHP Tutorials : Storing Images in MySQL with PHP (part 1) - Why store binary files in MySQL using PHP?
    Java Tutorials : Nested For Loop (part 2) - Program to create a Two-Dimensional Array
    Java Tutorials : Nested For Loop (part 1)
    REVIEW
    - First look: Apple Watch

    - 3 Tips for Maintaining Your Cell Phone Battery (part 1)

    - 3 Tips for Maintaining Your Cell Phone Battery (part 2)
    VIDEO TUTORIAL
    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

    - How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
    Popular Tags
    Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS