Linked Questions
26 questions linked to/from What does the "static" modifier after "import" mean?
0
votes
1
answer
7k
views
Why do we need to import "org.junit.Assert " static? [duplicate]
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 ...
1
vote
4
answers
2k
views
StandardOpenOption issue java [duplicate]
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[] ...
0
votes
2
answers
900
views
What does static imply in import static org.mockito.Mockito.*; [duplicate]
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
-1
votes
3
answers
219
views
What is the purpose of using static to import package? [duplicate]
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 ...
-3
votes
2
answers
110
views
What does it means when adding import static? [duplicate]
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?
0
votes
1
answer
157
views
Call method without declare object in Java [duplicate]
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 ...
0
votes
0
answers
40
views
Does static imported class loads different from non static import [duplicate]
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 ...
523
votes
11
answers
290k
views
What is the difference between include and require in Ruby?
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 ...
276
votes
25
answers
1.2m
views
Global variables in Java
How do you define Global variables in Java ?
86
votes
9
answers
232k
views
#define in Java
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
...
31
votes
8
answers
32k
views
Are there any advantages of using static import over import? [duplicate]
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 ...
22
votes
5
answers
78k
views
Meaning of the import statement in a Java file
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 ...
4
votes
1
answer
34k
views
Why i am unable to use Collectors in my code in java Stream? [closed]
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....
5
votes
5
answers
44k
views
How to import stddraw correctly?
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 ...
6
votes
3
answers
7k
views
Spring Controller Testing. Can't seem to find MockMvcRequestBuilders
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 ...