• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help with Java code

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there anyone kind enough and willing enough to help me with 2 java codes and explain them to me? Im pretty new to Java coding and actually have to explain my codes lines by lines (what's happening in the code) for a school task. I'm trying my best but still it isn't easy especially when I haven't done any type of java coding.

https://i.stack.imgur.com/tpsu3.png
https://i.stack.imgur.com/AUw05.png
 
Marshal
Posts: 79180
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Please post the code here, and tell us what the task is supposed to do.
 
Saloon Keeper
Posts: 27764
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And likewise welcome. But please don't post screen shots. Just copy-and-paste the code into our message editor. Use the "code" tags (created by the editor's "Code" button) to wrap the text so that your formatting will be preserved.
 
Alan Alaan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please write private not Private. It won't compile if you write Private.
Now you have some code which you can use, but what is it supposed to do?
Apart from missing indentation, I can see some other problems.
 
Alan Alaan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well we're supposed to make a JFrame Gui application when you press on the save button its supposed to save the students identity to an array and to show all students that are saved etc. Hope its enough to understand!
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do all your saving before you write the GUI. The GUI ought to instruct the other objects what to do, so you need to complete those objects first.
 
Alan Alaan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the code above is "Java class" code the part with putting the codes to the Gui frame is already done. Do you still wanna see the coding part of the Gui?
 
Ranch Hand
Posts: 127
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First I spot the errors most likely caused by some not-for-programming word processor:
- the quotes gone bad from the ASCII double quote " to some fancy text markup ones
- mostly auto-correction: capitalized keyword private
- indentation gone missing
All easy fixable - but next time either stick to the very simple notepad or use an editor for programming instead of some word processor like Word or others. Programming source code is far from regular text, hence it's called source CODE instead of source TEXT.

Aside from that I'm not sure what you're asking and what's your homework.

Im pretty new to Java coding and actually have to explain my codes lines by lines (what's happening in the code) for a school task.


So from this I understand your homework is to explain this code to someone else. Your question

Is there anyone kind enough and willing enough to help me with 2 java codes and explain them to me?


is basically us doing your homework. So, I guess the answer will rather be: NO.
Otherwise it may help if you try to re-phrase what your homework is, what you're supposed to do, how far you already come and what you struggle with. This way one from us can easier decide to may or may not put effort in helping you without doing your homework and present you with a read-for-copy'n'paste answer - as this board is to help not to solve problems or do homework.
Otherwise, if you just want someone doing your work you can offer payment. There's a sub-forum for offerings. But I would suggest: If you just do it for the sake of have something to put in your resume I would recommend you either to start learning or cancel your study. You may can get pretty far, but at one day you will hit a point where you cannot progress further cause you didn't learned the required skills and noone is willing to help. I've seen several to land on the street cause they tried to cheat the system - don'T make this mistake.
 
Alan Alaan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm not actually asking anyone do my homework. I've already sent the codes to our teacher and they all passed. My problem as I said earlier is that we have to record ourselves explaining the codes. That's what I'm asking if anyone can actually help me with that. Like break them into piece by piece and explain what each part is doing. I'll be forever grateful if anyone helps me
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm confused. If you wrote that code, then how did it pass if you don't know how it works? That kind of makes me think the code you submitted as your work wasn't actually your work...

Would you care to clarify?

Probably the best way for you to do this is try to write down a "script" for what you will record and letting people comment on that script.

For example,  you might write down as part of the script:

Line 5 declares a private startTemin field which will be initialized to "h19" because ... (give your reason for using this as the initial default value)
 
Alan Alaan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's exactly what I'm asking to get help with. I need to explain all lines in my code. I did do the coding but I wasn't alone since many teachers and even students helped me because it was just a thing as teamwork.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
None of what you have shown is at all complicated. Please have a go.
 
Junilu Lacar
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Alan Alaan wrote:That's exactly what I'm asking to get help with. I need to explain all lines in my code.


The way help is handed out here is that you, as the one needing it, have to show what you've done first. Then we who would like to help will give feedback and advice. Rarely does it ever go the way you seem to want it go, where we explain what's happening to you. That's kind of like you asking for help making your bed and then standing to the side as you watch whoever is trying to "help" you do all the work.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic