Linked Questions

0 votes
1 answer
7k views

I tried to enter assertTrue into code and found that i need to import junit lib. In this code, import static org.junit.Assert.assertTrue; //import org.junit.Assert; with this didnt worked public ...
R.Nish's user avatar
  • 73
1 vote
4 answers
2k views

I have this simple java code: import java.nio.file.*; import java.io.*; public class Write { public static final String PATH = "/home/user/Desktop/hello.txt"; public static void main(String[] ...
IDK's user avatar
  • 465
0 votes
2 answers
900 views

What does static mean in import static org.mockito.Mockito.*; I have seen statements like import java.util.*; but it never had static. Thank you
Steven's user avatar
  • 11
-1 votes
3 answers
219 views

Possible Duplicate: What does the “static” modifier after “import” mean? import static java.nio.file.StandardOpenOption.APPEND; What is the role of static in it?And why is ...
CoffeeCup's user avatar
-3 votes
2 answers
110 views

I saw some code over the web like: import static org.mockito.Mockito.*; Can someone please tell me what this static means in this case?
The Dr.'s user avatar
  • 576
0 votes
1 answer
157 views

I have the following problem. I wrote a project that contains a class and methods in it. I have exported the project to the jar because I want to use it as a library in another project. Is it possible ...
Gorgeo's user avatar
  • 17
0 votes
0 answers
40 views

Static import gives direct benefit of not using the class name and access the static fields directly like import static java. Lang. System; will allow us to use out.println directly instead of ...
hi.nitish's user avatar
  • 3,034
523 votes
11 answers
290k views

My question is similar to "What is the difference between include and extend in Ruby?". What's the difference between require and include in Ruby? If I just want to use the methods from a module in ...
Owen's user avatar
  • 22.9k
276 votes
25 answers
1.2m views

How do you define Global variables in Java ?
aTJ's user avatar
  • 3,913
86 votes
9 answers
232k views

I'm beginning to program in Java and I'm wondering if the equivalent to the C++ #define exists. A quick search of google says that it doesn't, but could anyone tell me if something similar exists ...
Meir's user avatar
  • 12.8k
31 votes
8 answers
32k views

Consider the following class public final class Constant { public static final String USER_NAME="user1"; //more constant here } This class in the package B. Now I am going to use this in package ...
Ruchira Gayan Ranaweera's user avatar
22 votes
5 answers
78k views

Can any one clearly explain to me what exactly happens when we use the import statement in Java files? Does it increase the size of the file if we add more and more java classes? Why don't we use ...
Pedantic's user avatar
  • 1,378
4 votes
1 answer
34k views

import static java.util.stream.Collectors.*; import java.util.*; import java.lang.*; //import java.util.Collections; public class HelloWorld{ public static void main(String []args){ System.out....
Prashant Singh's user avatar
5 votes
5 answers
44k views

Editor: IntelliJ CE What I want: Be able to write setCanvas(500,500); Instead of StdDraw.setcanvas(500,500); Problem: I can't figure out how to correctly import the Stddraw library. If i simply ...
Morgantuan's user avatar
6 votes
3 answers
7k views

I'm trying to write some Unit and Integration tests for my Spring Controllers following this guide and Spring's documentation for testing MVC controllers The problem is that I'm unable to find the ...
user6123723's user avatar
  • 11.3k

15 30 50 per page