+ 1
Can i write check prime number code in one line using java language.
5 Respuestas
+ 8
yes😂
+ 6
Technically, you can write your entire program on one line.
+ 4
*Less lines of code does not mean the algorithm is faster.*
You can make it look like one line of code.
Create a separate file for a class.
Then create a public static boolean method called isPrime(int x). Which finds out if the number is prime.
Then, you can go to your main file and simply write:
myClass.isPrime(userInput);
This is what things like Math.pow() or Collections.sort() do. It isn't really one line of code, only appears to be to make the programmer have to look at less.
(Or you can do what @nektos said and just don't hit 'enter' in your program 😶)
+ 3
Hey, is there really any such one line code?
+ 1
I need code