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

Java Circles Arrays
Methods in String Class               The colored to comment.

Introduction



class Circles {
double radius; 

public Circles (double r){
radius = r;
}

public double Circumference  (){
return 2 * Math.PI * radius;
}

public double Surface (){
return Math.PI * Math.pow(radius,2);
}

public void Display (String Kind){
System.out.println("\n\t The circle" + Kind + " has the following 
features: \n\t Radius = " + radius + "\n\t Circumference   
= " + Circumference () 
+ "\n\t Surface = "  + Surface ());
}

}

public class TestCircles{

public static void main (String[] args){
final int MAX = 7;
Circles [] circle = new Circles [MAX];
for (int k = 0; k <= 6; k++){
circle[k] = new Circles (k+1);
}

int NumCircles = 4;
Display (circle, NumCircles);
}

static void Display (Circles [] circle, int m){
System.out.println ("\n The features of the " + m +  " 
circles are as follows:\n");
for (int i = 0; i < m; i++)
circle [i].Display (" of index " + i);
System.out.println();
}



II. The execution gives:

 how to build an array:

ConstructorName [] ItsName = 
new ConstructorName [MaxIdex]

ConstructorName [index].Methode();



C:\Java>javac TestCircles.java
C:\Java>java TestCircles

 The features of the 4 circles are as follows:


         The circle of index 0 has the following features:
         Radius = 1.0
         Circumference   = 6.283185307179586
         Surface = 3.141592653589793

         The circle of index 1 has the following features:
         Radius = 2.0
         Circumference   = 12.566370614359172
         Surface = 12.566370614359172

         The circle of index 2 has the following features:
         Radius = 3.0
         Circumference   = 18.84955592153876
         Surface = 28.274333882308138

         The circle of index 3 has the following features:
         Radius = 4.0
         Circumference   = 25.132741228718345
         Surface = 50.26548245743669




  
Google
Web
ScientificSentence
 




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


© Scientificsentence 2009. All rights reserved.