r/learnjava • • Dec 29 '21

How to write a program?

I guess it sounds strange because as I try to write it down to ask the question it sounds strange to ME... I landed a job that requires me to know java, but not, how to write a java program. And (can you say "Unicorn"?) they are teaching me Java on the job via a Udemy course and some hands-on instruction from a couple of the dev team.

I am hip-deep into this Udemy course and learning Java at a furious pace. I have learned many concepts and constructs and syntax... but not the basic building blocks of a program.

Would one (or more) of you either point me to a resource or explain - not the code - but the pieces of a program. Packages, classes, wtf is a jar?, how do these (and whatever I am missing) stack together to become an actual, fully realized Java Program?

In an exercise, I wrote a switch statement that takes a number, 1-12, as input and outputs the corresponding month. I'd like to make that exercise into a portable program and let my daughter fart around with it to learn that information, but I realized that after six weeks of grinding this course, I don't know how!

Before you ask... I ask here because I the dev guys are hellishly busy - which is why I have a job, I need to get some very tedious, customer-facing, sometimes Java-related scut work off their plate - and I don't want to bother them with personal curiosities that are outside the scope of my job duties.

https://lensdump.com/i/rjkPzZ

Here is an exercise I downloaded - I think from my UDemy class, it may be from another source.

The top level, "Project", is the container for everything else, that I get.

  • ExampleForLoop

  • External Libraries

  • Scratches and Consoles

are what...packages? (Scratches and Consoles / scratch.java doesn't have anything to do with anything, it's a snippet from another lesson about vectors...unless this was a lesson about iterating through a vector...)

  • .idea

  • out

baffle me...what are they, do I need them, do I create them or does the IDE do it for me?

  • src

seems to be the meat of the deal. Is LoopExamp.java what happens after classes

  • LoopExamp

  • Main

  • Student

are compiled?

What is ExampleForLoop.iml?

54 Upvotes

15 comments sorted by

View all comments

1

u/SlapdashSlamdance Dec 29 '21

I think the question is a bit open-ended. It depends on what you mean by a Program. This can be a bit of a leap conceptually, because you learn Java typically in an IDE where you get to see the output of your code and it seems like it's something completely different than the software that you download and run.

edit: whoops, accidentally pasted the same link twice.

1

u/Tigloki Dec 30 '21

This is almost exactly what I was trying to ask for. I find that I am so ignorant that even articulating an intelligent question can be difficult. I edited my original question to include this information:

------------------------

https://lensdump.com/i/rjkPzZ

Here is an exercise I downloaded - I think from my UDemy class, it may be from another source.

The top level, "Project", is the container for everything else, that I get.

ExampleForLoop

External Libraries

Scratches and Consoles

are what...packages? (Scratches and Consoles / scratch.java doesn't have anything to do with anything, it's a snippet from another lesson about vectors...unless this was a lesson about iterating through a vector...)

.idea

out

baffle me...what are they, do I need them, do I create them or does the IDE do it for me?

src

seems to be the meat of the deal. Is LoopExamp.java what happens after classes

LoopExamp

Main

Student

are compiled?

What is ExampleForLoop.iml?