Guess the output:
public class ForEachDemo {
public static void main(String args[]){
int a[]={1,8,1,1,1,1,1,1,1,1};
for(int i:a)//for each is for arrays display
System.out.println(a[i]);
}
}
Output:
8
1
8
8
8
8
8
8
8
8
Guess the output:
public class ForEachDemo {
public static void main(String args[]){
int a[]={1,8,1,1,1,1,1,1,1,1};
for(int i:a)//for each is for arrays display
System.out.println(i);
}
}
output:
1
8
1
1
1
1
1
1
1
1
Sunday, November 20, 2011
Sunday, November 13, 2011
processing streams
perform some sort of operation such as buffering or encoding as they reaad and write.
Data sink stream
they are used to read from or write to specialized data sink such as files pipes strings.
byte stream
Input and output stream are byte stream.eg:images ,sounds.
2 types:
1.ObjectInputStream
2.ObjectOutputStram
2 types:
1.ObjectInputStream
2.ObjectOutputStram
System.err
System is a class in java.lang package and contain a predefined stream variable err.
refers to standard error stream which is also console
refers to standard error stream which is also console
it is object of type PrintStream.
it is a byte stream.
System.in
System is a class in java.lang package and has a predefined stream variable in.
refers to standard input that is keyboard.
it is an object of type input stream.
it is a byte streamrefers to standard input that is keyboard.
it is an object of type input stream.
System.out
System is the class name and out is a predefined stream variable.
refers to standard output stream which is console
it is object of type PrintStream.
it is a byte stream.
refers to standard output stream which is console
it is object of type PrintStream.
it is a byte stream.
stream
java provide input and output through stream.
Streams are ordered sequence of data that have a source or destination. two categories
1.character stream
2.byte stream
Streams are ordered sequence of data that have a source or destination. two categories
1.character stream
2.byte stream
Sunday, November 6, 2011
java program to add 2 numbers
//add this program to your package
class addnum
{
public static void main(String [] args)
{
int number1=Integer.parseInt(args[0]);
int number2=Integer.parseInt(args[0]);
System.out.println(number1+number2);
}
}
/* run the program and enter 2 integer values like,
4 5
output:
9
*/
java program to add 2 strings
//include this program in your package
class calc
{
public static void main(String args[])
{
System.out.println(args[0]+args[1]);
}
}
/*run the program and enter 2 strings
like,abc def
output:abcdef
*/
Subscribe to:
Posts (Atom)
-
Hi Guys , In this blog I will share information related to error : can't bind to 'formcontrol' since it isn't a known pr...
-
Hi Guys , This blog is about the error " Target container is not a DOM element. " The full error in the console log is ...
-
Error Blog This blog is about the error Error: Objects are not valid as a React child Problem Statement error on start of...