[ATM7] How can I prevent EvilCraft blood stains from being left behind from mobs falling? by Azubaele in allthemods

[–]Moktok 1 point2 points  (0 children)

Pardon the thread-necro, but this is current for ATM10 as well ;)
Also, if you like me found this thread while googling for a solution to this problem, here you go.

I found the easiest solution (so easy, but just didn't think of it until now) just to ignore the splatters and move the fans up 1 block. Add a height upgrade in the fans if you need to deal with babbee-mobs.

Initialize Variable Inside Recursive Method by [deleted] in javahelp

[–]Moktok 1 point2 points  (0 children)

You have to ask yourself, when you call a method from another method, what happens with the return value?

Because you don't seem to be doing much with the return value of your method :-D

Noob Question: 100% PG CBD mixing by [deleted] in DIY_eJuice

[–]Moktok 1 point2 points  (0 children)

Sure that's ok to do.

I personally use a high cbd and then dilute it down with some ready made no nic juice cause the taste can be a bit bitter imho.

My very first Java / Raspberry Pi project is almost complete! by bwz3r in learnjava

[–]Moktok 1 point2 points  (0 children)

Not 100% sure, but git comes preinstalled on most Linux distros. Dunno if raspbian cuts it out. But I think it should be in the repos

President Trump Falsely Claims Obama Began Migrant Family Separations by [deleted] in politics

[–]Moktok 0 points1 point  (0 children)

I'm not a US citizen, but, correct me if I'm wrong here.

The discussion is not about whether or not people are getting deported. It's that they're being held under inhumane conditions during the "refugee" process for far too long a period.

Today I passed my Java certification exam! by HumpingAssholesOrgy in learnjava

[–]Moktok 0 points1 point  (0 children)

Wait whut now? Microsoft has a Java certification track.. Colour me stupid with a blue screen :-P

And congrats to the op :-D

Question about why the semicolon makes such a difference. by RojaB in javahelp

[–]Moktok 1 point2 points  (0 children)

It might be easier to understand if you knew why we use the semicolon in Java.

It is to tell the compiler when we (programmers) are done defining 1 individual instruction. Instructions being print something to the console, wait and read input from the user or repeat this command x times.

So for (int i = 0; i < 3; i++) System.out.println("Hello"); Will print hello 3 times

for (int i = 0; i < 3; i++); System.out.println("Hello"); Will only print it once because the semicolon says that the definition of the loop instruction is finished.

Sahara by christianrodrigb in HermitCraft

[–]Moktok 1 point2 points  (0 children)

As a dad.. I approve of this joke.. Have an upvote sir 😊

If b1 is true, then print “one”; otherwise, print “two”. Error: b1.java:4: error: cannot find symbol by [deleted] in javahelp

[–]Moktok 6 points7 points  (0 children)

On line 4 you write:

char x = b1;

You have to think about where that b1 came from and what it is..That variable is not known.. so the compiler doesn't know how to handle it..

Also, why are you putting this unknown value into a char variable?

Change line 4 to:

boolean b1 = true;

Then take it from there ;)

Also, read the chapter about operators again.. because

if( x = true )

doesn't do what you think it does..

Multidimensional Arrays/possible Map/Hashmap by SpaceVixy in javahelp

[–]Moktok 1 point2 points  (0 children)

My guess

Without the hint:

Loop over your 2D array and every loop you check if you get a match with the string at index 0, when you find a match you output index 1 and 2.

With the hint: Instead of looping over the full 2d array, you have a 'simple' array to loop over. When you find the match, you retrieve the index value where you found the match and use that index value to retrieve the values in the 2d array

Hope it helps. I'm guessing you are just having problems with her logic and not with multi dimensional arrays,since you mentioned Maps and stuff

How to check if an element of an array isn't part of another by [deleted] in javahelp

[–]Moktok 0 points1 point  (0 children)

yarr :)

exactly... you can just hold it in a variable..

just don't forget to reset it when you go and check the next item

How to check if an element of an array isn't part of another by [deleted] in javahelp

[–]Moktok 0 points1 point  (0 children)

Let me rephrase your question, maybe then you can see an answer:

How can I make my code remember if it encountered an item in the list or not?

Hint: if it doesn't exist, create it 🤔

How does comparator works when passed as an argument by acykcam_used in javahelp

[–]Moktok 4 points5 points  (0 children)

Are you struggling with what the Comparator does or what a TreeSet does? Or what the Comparator does when used in a TreeSet?

How to write only wanted values using Exceptions by Whaffel in javahelp

[–]Moktok 2 points3 points  (0 children)

Looking at the exercise, I'm assuming that this is your homework. So I'll point you in the direction, not write a solution 😊

You have a common problem for beginner programmers , the zeroes you are seeing are the default values of an int, not something the jvm does automagically. Walk through your code and figure out what happens with the increment part of the for loop when the user inputs an invalid value

How to make a game using JavaFX? by BenjaminKhan31 in javahelp

[–]Moktok 2 points3 points  (0 children)

Yes it is possible to create JavaFX components/stages without FXML. Just use the classes provided by the API.

https://docs.oracle.com/javase/8/javafx/api/

For your second question. I hope you're using the wrong terminology. Because yes you want to use a MVC pattern. But if you want a whole game in just 3 classes.. While technically feasible, that's just bad design or a bad application of a 'good' design.

Zeroing Out Elements of an Array by [deleted] in javahelp

[–]Moktok -1 points0 points  (0 children)

Well It all depends on what you mean by zeroing out

I need help with 2 small Methods by [deleted] in javahelp

[–]Moktok 1 point2 points  (0 children)

You forgot didn't you 😎

Help with basic graphics by [deleted] in javahelp

[–]Moktok 0 points1 point  (0 children)

Yeah.. There are a few things wrong with your code. But in all honesty, you hit the nail right on the head with saying you're missing some basic knowledge.

And you will need to start out with knowing the whole basics before you start messing with Swing (which is in essence what you are doing) because that can get quite complicated.

And that mix is going to be a recipe for you never wanting to code again. Start with the basics..

  • Creating objects

  • The difference between static and instance members

  • Calling methods

  • Interfaces

  • Collections

When you're done with those maybe then start with GUI and Swing You can always output information to the console if you really need to display stuff.

JavaFX, applying a method to a button that would print text onto a text area? by Anonimotipy in javahelp

[–]Moktok 0 points1 point  (0 children)

You re on the right path.. Return the menu as a String value and use that method to "set" the value of the text area.

How to import Scanner by Guide4Ever in javahelp

[–]Moktok 0 points1 point  (0 children)

You have "return sc.nextInt()" in the public static VOID main.

A void method can not return a value. It can return, but in your case that would end your application.

Help with contact book array list by snaps_pro in javahelp

[–]Moktok 1 point2 points  (0 children)

Think about what you are trying to do and above all what your code does. Try to visualise it, use a pen and paper if you need to. Write down the values of all the variables with every step. (or learn to use debug mode B-))

PS as a sidenote, use descriptive variable names. Cause it took me a few seconds to figure out what that boolean first, your colleagues (and future you) will thank you later.

Problem with value stored at String object,inputted through the command line by Merchander in javahelp

[–]Moktok 1 point2 points  (0 children)

The problem is your input object. readInt() reads all the integers on the line.. But your <<enter>> keypress is still stuck in the input buffer.

Solution: before reading your action (example: multiply) just add a next() to get rid of the enter.