Robert D. Smith

Ranch Hand
+ Follow
since Oct 04, 2013
Cows and Likes
Cows
Total received
5
In last 30 days
0
Total given
0
Likes
Total received
31
Received in last 30 days
2
Total given
87
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert D. Smith

you are going to need something like this ---

main()
  create an instance of average
  pass your ints to your new instance
  don't forget the return string
  print out the result


For what it's worth, your getAverage works.

Regards,
Robert
6 days ago
There is a built in grep like tool for Windows -- findstr.  It's a cmd line program, and I have zero experience with it.  Thought I'd mention it, in case it applied to this discussion.

Regards,
Robert
1 week ago

Eric Arnold wrote:Frankie, take a look in C:\Program Files\Java\
I believe that is the default installation directory on Windows. In there you should find your jdk-10.0.1 installation.
As for the PATH environment variable, it's done automatically when you installed Java, so assuming it's installed, you should be able to use java/javac/jar from the command line in any directory.


This is partially correct.  The Oracle installer will set a path to C:\Program Files (x86)\Common Files\Oracle\Java\javapath which contains the java and javaw executeables.  The path to the jdk is not set.  (New laptop, fresh installs of everything), and will need to be set through the control panel.

Frankie -- there are plenty of tutorials and how-tos to set the path.  Several even contain step by step pictures.  Since you have installed java 10, assuming you took the default install directory, you will find java installation at C:\Program Files\Java\jdk-10.0.1\bin

Normally, I would post the step by step here; but, given your level of experience I strongly suggest you google something along the lines of windows 10 set environment variables

Good luck, have fun and ask lots of questions.

Regards,
Robert
1 week ago

Stephan van Hulst wrote:By the way, why does the entity have an ID if it already has a unique name? The ID is superfluous and just plain cumbersome.



This is what jumped out at me first.  As it is, it will fail on those rare names, like Robert Smith, that happen to be the same yet have different user ids.  I would think a PK of ID and name combined would be called for, but that's just me.

Regards,
(the one and only) Robert Smith
1 week ago
If I understood this correctly, you are asking the user to input two (2) integers, multiply these two numbers together, and store the result.  Rinse and repeat.



Check the syntax on the println method.

Of course, We Are Not a Codemill, but this should get you on the right path, and hopefully a clear  this up for you,  Sorry about the crappy formatting -- something to do with the way I did the copy, cut, and paste.

Regards,
Robert
1 week ago

Frankie Bailey wrote:

OK - I had only downloaded the JRE.  I went and downloaded the JDK.  I have both but I understand the JDK includes the JRE. What next? How do I get to a place to run a java program?

I know how to use the command line in the dos window. Would that be the only way to execute a java program unless I have an IDE?

Also, what is the purpose of the JRE?  I must be sounding like a head without brains here.

Thanks for the responses - every little bit helps.




I see others have answered the what is the JRE question.

It is recommended that you first learn Java using the command line, and holding off on an IDE.  IDEs, while convenient, have been found to hide certain functional matters (how to handle packages comes to mind).  Using the command line will give you the skills needed that an IDE will hide and it will make you a better programmer.

As to what to do next, and where to get started, I suggest The Java Tutorials.  Remember, the best way to start your project is to turn off your computer, find a pad and pencil, and write down what it is you want to accomplish.  Keep at this until you have a good understanding of what your requirements will be.  Doing this will help you plan out what objects you will need, and will make actual coding much easier.  This simple method will reduce the number of times you will start over from scratch, throwing away classes, rewriting the same class multiple times, all that fun stuff.

Good luck.  Ask lots of questions.  Let us know when you have solved a problem you have asked here at the ranch for advice.

Regards,
Robert
1 week ago
Why not something as simple as reversing a copy of the string, and then check if they are equal?  Seems much simpler than running through a loop, counting characters, and such.

Just a thought,

Regards,
Robert
2 months ago

Robert Manley wrote:
Copied java file into this window, highlighted and pressed "code" button.
Then clicked "preview".
No change. no line numbers.
What am I doing wrong?
Particularly annoying as I know I have done it correctly in the past.



Hopefully, this offers a bit of clarification.

Based on my interpretation of what you wrote here, is that you pasted in your code, and then you pressed the code button.  Press the code button first. You should see the following line.

[code=java][\code]

Move the cursor between the ] and [ and then paste your code.  If this isn't the problem you are having, maybe give a little more detail such as enumerating each step you took.

Regards,

Robert
3 months ago

Nasio denasio wrote:
This statement is ridiculous considering that this is a Beginning Java forum. Do you tell everyone who asks question here to think for a moment what they need to do differently to make the code work? These forums are for asking questions or not?

If you want to help with tips or code, then that's great! Otherwise keep quiet and let others who are willing to help answer.



I found your reply rather irksome. so instead of trying to explain anything to you, I will just point you (not that I think you will actually read it) to the We Are Not a Code MIll documentation.  [edit: comment deleted (none of my affair_]
3 months ago
What you are asking for is a very broad topic.  Much like mathematics, writing, art, the only way to learn and get better is to do by doing.  Any google search for something like "java programming projects" should return enough to keep you busy for a long time to come.  You might also look at the Cattle Drive here at Code Ranch, and work through the projects.  They start off simply enough and get progressively more complex.
4 months ago
Thanks for the review, Jeanne.  Buying this for my granddaughter(s).  The 12  year old is always borrowing my laptop for school projects, and this might intrigue her eough to go a bit further in her studies.  And she has expressed interest in a time or two.
10 months ago
Read an article a whlle back where Amazon is not the cheapest,and like everything else, shop around.
10 months ago
I've used other Murbach books, and have found them quite new programmer friendly. My opinion only -- your mlieage may vary.
10 months ago
I confess that I am not the brightest crayon in the box, but I am a tad confused.  In the declaration  int[] somearray = {3, 1, 2, 4};    doesn't the int[] declare the array as type integer?  I don;t understand how/why this declaration implies the array is untyped.
11 months ago
Didn't vote -- no none of the above option.  I do use Amazon, but that is mostly due to health reasons; I don't get around as well as I once did and I have given up driving.  Amazon is strictly a convenience for me, since I don't like asking the spousal unit or kids to run me places, and here is zero public transportation here.

As for the other four, I don't really have a need for any of them.  I use google's search engine, more out of apathy than any other reason, the rest I don't use at all.  Well, I do have one laptop left with windows, and the next time I am forced to reformat/reinstall it will probably become non-windows.  In short, I could easily do without all five.
1 year ago