Files in Java Programming Section One
Reading data from InputStream using commandLines
1. Command-Line Arguments Any Java technology application can use command-line arguments. • These string arguments are placed on the command line to launch the Java interpreter after the class name: public class TestArgs { public static void main (String [] args){ for (int i=0; i< args.length; i++) System.out.println("args ["+i+"]is :" +args[i]); } }
• Each command-line argument is placed in the args array that is passed to the static main method as below :
public class CallTest { public static void main(String[] args) { String args1[]={"seeyou","ali","mohammed"}; TestArgs xx= new TestArgs(); xx.main(args1); }} 2. I/O Stream Fundamentals A stream is a flow of data from a source or to a sink A source stream initiates the flow of data, also called an input stream. A sink stream terminates the flow of data, also called an output stream. Sources and sinks are also called Input streams and output streams Types of node streams are files, memory, and pipes between threads or processes.
For example to read from console, we use the read() method as below:-
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|