0
Q:

What is the output of this program ?

class main_arguments {
            public static void main(String [ ] args)
            {
                String [][] argument = new String[2][2];
                int x;
                argument[0] = args;
                x = argument[0].length;
                for (int y = 0; y < x; y++)
                    System.out.print(" " + argument[0][y]);           
            }
        }

A) 1 1 B) 1 0
C) 1 0 3 D) 1 2 3

Answer:   D) 1 2 3



Explanation:

In argument[0] = args;, the reference variable arg[0], which was referring to an array with two elements, is reassigned to an array (args) with three elements.
Output:
$ javac main_arguments.java
$ java main_arguments
1 2 3

Subject: Java
Exam Prep: GATE
Q:

How to do MultiThreading in Java?

Answer

To do multi threading in java we use interfaces and classes defined in java.lang package.


Those classes and interfaces are:


Java.lang.Runnable, Java.lang. Thread, Java.lang.ThreadGroup

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1715
Q:

What is MultiThreading?

Answer

Executing two or more blocks (threads) of a program at a time is called MultiThreading.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2121
Q:

What is MultiTasking?

Answer

Executing more than one program simultaniously.(i.e at time)


Ex:


Windows media player  is a program


Internet explorer(IE) is another program executing both the programs  at a time is called multi tasking.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2024
Q:

What is Thread?

Answer

A Thread is a block of code that can be executed in parallel with another block of code.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2256
Q:

How to get contents of the folder?

Answer

File[] listFiles();


this method returns list of files stored in a directory.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1616
Q:

How to get last modified date of a file?

Answer

long lastModified();


we can give this return value to a date object and we can get data to be displayed.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1531
Q:

How to check that whether the file object is pointing a folder or not?

Answer

boolean isDirectory();

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1711
Q:

How to check that the file object is pointing a file on HD?

Answer

boolean isFile();

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1558