An online markdown blog and knowledge repository.
Not everything needs to be recorded here.
Consider this a quick-ref or study guide to help learn key facts that will help learning, and coding with, Java.
You can use Gradle to "set up" a project for Java development.
gradle init
application
, Java
, Groovy
, JUnit4
, single application project
settings.gradle(.kts)
Assign name to build, overriding default behavior of naming build after PWD: rootProject.name = ''
Define the build is a single subproject ('app' in this case) containing code and build logic. Use 'include ...' statements to add other projects: include('app')
Other remarkable items in the config:
plugins: Apply plugin to support building CLI app in Java
repositories: Define how to resolve dependencies e.g. Maven Central
dependencies: Define testing framework
application: Dependency used by the app
tasks.named: Defines main class for the app
$app_name.java
is created automatically with a public static void Main(args[]){}
entry function.
AppTest.java
is generated to start-up a class file that will contain unit tests for the app.
Run your app from within the PWD to view app output and other task results ./gradlew run
Run Spring MVC from the command line using: ./gradle bootRun
Build your app from within the PWD and view task output: ./gradlew build
To force a full refresh, if that task is available in the gradle config use: ./gradlew clean
and then: ./gradlew build
Execute tests from the Project root directory: ./gradlew test
Type => is-a => memory byte number 1 byte short number 2 bytes int number 4 bytes long number 8 bytes float number 4 bytes double number 8 bytes char character 2 bytes boolean true/false 1 byte
Variables must be defined before they can be assigned to.
Combine definition with assignment in one line as necessary.
Cast a variable as a float type:
float myFloat = (float)4.5;
var myFloat = 3.7f;
Only allowed in class String.
Return to Parent Readme.md