Your SlideShare is downloading. ×
Java
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Java

674
views

Published on

Published in: Technology, News & Politics

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
674
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
29
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Array Import java.io.*; public class status { public static void main(String argv[]) throws IOException { int i, anzahl, auswahl; String status[], str; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); System.out.print(quot;Geben Sie die Anzahl der Stati ein: quot;); str=input.readLine(); anzahl=Integer.parseInt(str); status= new String[anzahl]; for(i=0;i<anzahl;i++) { System.out.print(quot;Geben Sie den Status ein: quot;); System.out.println(); status[i]=input.readLine(); } System.out.println(quot; Nr Statusquot;); for(i=0;i<anzahl;i++) { System.out.println(quot; quot;+(i+1)+quot; quot;+status[i]); } System.out.print(quot;Welchen Status wollen Sie sehen? quot;); str=input.readLine(); auswahl=Integer.parseInt(str); System.out.println(status[auswahl-1]); } }
  • 2. Klassen import java.io.*; public class Main { public static void main(String argv[]) { Quader quader1; quader1=new Quader(); quader1.breite=10; quader1.hoehe=20; quader1.laenge=30; quader1.showVolumen(); quader1.showOberflaeche(); } } public class Quader { //Attribute public int laenge; public int breite; public int hoehe; //Methoden public void showVolumen() { int volumen; volumen=breite*hoehe*laenge; System.out.println(quot; Das Volumen betraegt: quot;+ volumen + quot;m*m*mquot;); } public void showOberflaeche() { int oberflaeche; oberflaeche=2*(breite*laenge)+(breite*hoehe)+(laenge*hoehe); System.out.println(quot; Die Oberflaeche betraegt: quot;+ oberflaeche+ quot;m*m*mquot;); } }