0

Hi, i'm new to learning java, and i'm kind of confused on how you can write code that does useful stuff.

I'm about half way through the java course and i'm confused on how it can be used other than asking the user questions, and making little programs. It kind of just seems like it's all just useless, can someone please lead me in the right direction here, or even examples of actual programs and stuff. Thank you so much.

4th Feb 2017, 3:31 AM
StaticComs
StaticComs - avatar
2 Réponses
+ 3
People don't necessary program things because they're useful. Have you heard of a type of program called a quine? It's a program that takes no input and displays its source code as its only output. Useless, yes, but it's somewhat mind-bending if you think about it. Point is, if you want to program, you need to be in the right mindset. If "it's all just useless" is your deal, then I'll do what I can to change that. Here's a challenge - if you're interested in programming, this kind of thing ought to be your bread and butter. If not... I've got nothing to say. Anyway, I want you to write a program to sort this list of numbers, from least to greatest: [33, 14, 90, 27, 73, 88, 65, 2, 91] When you're done with that list, sort this second list with the exact same program you wrote: [182, 771, 265, 120, 488, 776, 162, 910, 614] Sounds easy, right? Not so fast. Think about it really hard - how would you get a computer to do it? You can do it whatever way you like, as long as you don't use built-in Java methods that sort them for you. If you need help, I suggest looking up sorting algorithms - you'd be surprised by how much study is devoted to putting objects in the right order. Just something to chew on. You don't really have to give me an answer, but at least try it. If you don't know where to begin, keep researching and taking lessons.
4th Feb 2017, 4:35 AM
DaemonThread
DaemonThread - avatar
0
I was thinking like a program that gets the length of an array. Tests a number in an array then compares it and moves it to an appropriate position. After that it would subtract 1 from the index number and test that, and so on. However i have no idea how i would write that. Thanks for the response.
5th Feb 2017, 5:38 PM
StaticComs
StaticComs - avatar