Computer Science, asked by shrestha13092007, 8 months ago

What is the name of the package that consists of System class ?​

Answers

Answered by PritamDJ
1

Answer:

Among the facilities provided by the System class are standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array. It extends class Object.

Fields:

public static final InputStream in: The “standard” input stream. This stream is already open and ready to supply input data. Typically this stream corresponds to keyboard input or another input source specified by the host environment or user.

public static final PrintStream out: The “standard” output stream. This stream is already open and ready to accept output data. Typically this stream corresponds to display output or another output destination specified by the host environment or user.

public static final PrintStream err: The “standard” error output stream. This stream is already open and ready to accept output data.

Typically this stream corresponds to display output or another output destination specified by the host environment or user. By convention, this output stream is used to display error messages or other information that should come to the immediate attention of a user even if the principal output stream, the value of the variable out, has been redirected to a file or other destination that is typically not continuously monitored.

Methods:

static void arraycopy(Object source, int sourceStart, Object Target, int targetStart, int size): Copies an array. The array to be copied is passed in source, and the index at which point the copy will begin within source is passed in sourceStart. The array that will receive the copy is passed in target, and the index which point the copy will begin within the target is passed in targetStart. Size is the number of elements that are copied.

Syntax: public static void arraycopy(Object source, int sourceStart, Object Target, int targetStart, int size) Returns: NA. Exception: IndexOutOfBoundsException - if copying would cause access of data outside array bounds. ArrayStoreException - if an element in the source array could not be stored into the target array because of a type mismatch. NullPointerException - if either source or target is null.

// Java code illustrating arraycopy() method

import java.lang.*;

import java.util.Arrays;

class SystemDemo

{

    public static void main(String args[])

    {

        int[] a = {1, 2, 3, 4, 5};

        int[] b = {6, 7, 8, 9, 10};

          

        System.arraycopy(a, 0, b, 2, 2);

          

        // array b after arraycopy operation

        System.out.println(Arrays.toString(b));

          

    }

}

Output:

[6, 7, 1, 2, 10]

Explanation:

please mare me a brainlist

Similar questions