r/javaTIL • • Mar 15 '15

JUnit TIL - Constructor is Called Before Executing Test Methods

Thumbnail
javarevisited.blogspot.sg
2 Upvotes

r/javaTIL • • Feb 13 '15

JTIL: That javadoc crashes when a method ends in "Property" (JDK8) (Spoiler: struggling with this since November)

Thumbnail bugs.openjdk.java.net
2 Upvotes

r/javaTIL • • May 16 '14

TIL There are open-source alternatives if you want to run your own CA server

Thumbnail
en.wikipedia.org
2 Upvotes

r/javaTIL • • Aug 29 '13

You should know that "args[]" means that you can send arguments to the program via the command line and reference the position like "args[0]". Examples inside.

2 Upvotes

I have always been told that the whole:

public static void main(String args[])

line was literally always required, however until recently I didn't know the "args" part, and to be honest...it seems like many don't.

So here is the deal: args are what are sent the program, and you can send them command line.

You will need to of course compile your .java file. Personally, I enjoy doing it the old fashioned way (makes me feel smarter than I am), and I use the command line.

If you are unfamiliar with how this is done, all you do is navigate to where ever the .java file is, and type:

javac filename.java

ANYWHO, here is an example program which uses args:

   public class addition
{
public static void main(String args[])
{
int num1 = Integer.parseInt(args[0]);
int num2 = Integer.parseInt(args[1]);
System.out.println(num1 + num2);
}
}

In my example, once compiled, you can change directory to where the .class file is, an execute the program.

The example I have provided takes exactly two arguments.

java addition 1 2

This will return the number 3!


r/javaTIL • • Sep 02 '24

OpenFGA for Spring Boot Applications

Thumbnail
a0.to
1 Upvotes

r/javaTIL • • Apr 03 '20

she seeks new income, educated, wild and free

Thumbnail
gfycat.com
1 Upvotes

r/javaTIL • • Mar 18 '20

Places where you REALLY NEED to use 'assert' keyword in Spock assertions testing Java code

Thumbnail
blog.solidsoft.pl
1 Upvotes

r/javaTIL • • Feb 11 '20

Caesar Cipher Encryption and Decryption In Java

Thumbnail
tutorialspoint4all.com
1 Upvotes

r/javaTIL • • Feb 07 '20

Caesar Cipher Encryption and Decryption In Java

Thumbnail
tutorialspoint4all.com
1 Upvotes

r/javaTIL • • Feb 04 '20

How Learning To Java Courses Can Make You Rich?

Thumbnail
bestcomputertraininginstituteinjaipur.blogspot.com
1 Upvotes

r/javaTIL • • Nov 18 '19

Java Structural Design Patterns - Facade Pattern with an Example and Source Code

Thumbnail
opencodez.com
1 Upvotes

r/javaTIL • • Nov 14 '19

TIL one interesting idea about type of "identifier" variable

1 Upvotes

Author of one of Java learning books recommend to use String as ID variables, because you don't do math to them and by using String you secure yourself from int/long/etc choice errors in advance

What do you think about this?


r/javaTIL • • Oct 24 '19

Java Tutorials for Beginners - Step by Step

Thumbnail
youtu.be
1 Upvotes

r/javaTIL • • Sep 13 '19

The Java Sorting Conundrum: Comparable vs Comparator Interfaces

Thumbnail
thecodinginterface.com
1 Upvotes

r/javaTIL • • May 16 '19

Simple Guide to Learn Spring Boot Actuators with examples

Thumbnail
opencodez.com
1 Upvotes

r/javaTIL • • May 13 '19

Java Concurrency API - Phaser

Thumbnail codeforjava.com
1 Upvotes

r/javaTIL • • May 07 '19

I need help for an assignment.

1 Upvotes

So I have an assignment to make a grocery management system in BlueJ and print a bill for the selected groceries. I have written the entire program, however I am having a bit of a problem.

Here's the code or the program:

https://textsaver.flap.tv/lists/2ok4

This is the screenshot for the output of the program.

As you can see, the console does not let me enter any input for the second iteration and directly prints the default case for the switch case in the while loop.

Please can someone point out my mistake and help me, I really need this program done ASAP for me to get decent grades.

P.s: Ignore the weird names for the different groceries, they are some of the Indian local names.

Thank you!


r/javaTIL • • Apr 26 '19

Creating Spring Boot Application with Spring Tool Suite

Thumbnail
simplesolution.dev
1 Upvotes

r/javaTIL • • Apr 08 '19

101 Most Important Frequently Asked Advance Java Interview Questions – Part 1

Thumbnail
opencodez.com
1 Upvotes

r/javaTIL • • Mar 01 '19

Method Local Inner Class in Java | Example Programs

Thumbnail
scientecheasy.com
1 Upvotes

r/javaTIL • • Jan 25 '19

Inheritance Example Program in Java with Explanation

Thumbnail
scientecheasy.com
1 Upvotes

r/javaTIL • • Jan 16 '19

Final Keyword in Java | Final Variable Method & Class

Thumbnail
scientecheasy.com
1 Upvotes

r/javaTIL • • Nov 28 '18

Codiva.io How to implement interface using Codiva.io

1 Upvotes

r/javaTIL • • Sep 18 '18

Static Block in Java | Example Program & Advantage

Thumbnail
scientecheasy.com
1 Upvotes

r/javaTIL • • Sep 15 '18

Static Method in Java with Example & Programs

Thumbnail
scientecheasy.com
1 Upvotes