Javascript  
 
  ScriptJava  
 
  Perl  
 
  PHP  
 
  ROR  
 
  ask us  
 

 

Applications
  1. Getting started
  2. Definitions
  3. First program
  4. Characters and Strings
  5. Object and methods
  6. Arrays and Circles
  7. Exceptions
  8. The main method
  9. Reading
  10. Writing file
  11. Vectors
  12. Stacks
  13. Map The Dictionary
  14. Lists
  15. Linked lists
  16. Collection
  17. Interfaces
  18. Scanner
  19. StringTokenizer
  20. Generics
  21. JDBC
  22. DataBase Queries
  23. JSP, The main step

Graphics

Applets
  1. Regards
  2. One Picture
  3. Calculator
  4. Random pictures
  5. Bouncing picture

Swings
  1. Buttons listeners
  2. TextFields
  3. Swing Example

JavaBeans
  1. The first step
  2. Example

Search a word:
   



© The scientific sentence. 2010

main (String [] args)
public static void main (String [] args) {}


/**
This program shows the arguments of the function main, that is 
the sring elements of the array named args. Executing the 
java class needs just  to set the values of the fuction as arguments. 
This program holds also an example of rising exceptions.
*/

//  First try: ----------------------------------

/*
class Arguments {
public static void main (String [] args) 
{
	//try{
	for (int i = 0 ; i<=3; i++){
	System.out.println("\n\t args (" + i+ ") = " + args [i]);
	}
	//}
	//catch (Exception e){
	System.out.println("\n\t The exception is catched.");
	// The message is: " + e.getMessage());
	//}
}
}

C:\Java>javac Arguments.java
C:\Java>>java Arguments
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at Arguments.main(Arguments.java:7)
C:\Java>
*/


// Second try: ------------------------------------------------------

class Arguments {
public static void main (String [] args) 
{
	try{
	for (int i = 0 ; i<=3; i++){
	System.out.println("\n\t args (" + i+ ") = " + args [i]);
	}
	}
	catch (Exception e){
	System.out.println("\n\t The exception is catched. The 
	message is: " + e.getMessage());
	}
}
}

// Execution: -----------------------------------------------
/*
C:\Java>javac Arguments.java
	C:\Java>java Arguments
			The exception is catched. The message is: 0
	
	
	C:\Java>java Arguments 0
		args (0) = 0
		The exception is catched. The message is: 1
  
  
	C:\Java>java Arguments  1 2
		args (0) = 1
		args (1) = 2
		The exception is catched. The message is: 2

		
	C:\Java>java Arguments  2 44 567
		args (0) = 2
		args (1) = 44
		args (2) = 567
		The exception is catched. The message is: 3


	C:\Java>java Arguments  2 44 567 777
		 args (0) = 2
		 args (1) = 44
		 args (2) = 567
		 args (3) = 777

	C:\Java>java Arguments  1 2 3 4 5
		 args (0) = 1
		 args (1) = 2
		 args (2) = 3
		 args (3) = 4

	C:\Java>java Arguments  1 2 3 4 5 6
		 args (0) = 1
		 args (1) = 2
		 args (2) = 3
		 args (3) = 4

	C:\Java>
*/
// ------------------------------------------------------------------


public static  void main (String [] args) {
System.out.println("The argument of the main 
method is an array of String elements.");}

  
Google
Web
ScientificSentence
 




chimie labs
|
scientific sentence
|
java
|
php
|
green cat
|
contact
|


© Scientificsentence 2009. All rights reserved.