Java
T
point
Home
Python
Java
JavaScript
HTML
SQL
PHP
C#
C++
DS
Aptitude
Reasoning
Selenium
DBMS
C
Android
Interview Q
Content Menu ▼
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Question 1
:
Given:
package com.company.application;
public class MainClass {
public static void main(String[] args) {}
}
And MainClass exists in the /apps/com/company/application directory. Assume the CLASSPATH
environment variable is set to "." (current directory).
Which one java command entered at the command line will run MainClass?
1.
java MainClass if run from the /apps directory
2.
java com.company.application.MainClass if run from the /apps directory
3.
java -classpath . MainClass if run from the /apps/com/company/application directory
4.
java -classpath /apps/com/company/application:. MainClass if run from the /apps directory