Posts by NinjaTroll • 1,752 points
37 posts
-
-2
votes1
answer148
viewsQ: Allocating to the heap is so bad? If so, why would we use it?
Whenever I deal with languages that are able to allocate in the heap, I hear advice that this is slow and should be avoided. I’ve read several responses that talk about heap and stack, but have…
heapasked NinjaTroll 1,752 -
-1
votes1
answer170
viewsQ: What is a constant?
A while ago I did a question about constants that didn’t work out so well and I saw that it was really possible to get a good content out of it, so I’m reshaping it. Even being something basic, I…
-
0
votes1
answer181
viewsQ: Is it possible to merge Java with Javascript?
For example, if I have a function soma(a, b) in Javascript and I want to use this function in a Java code, is it possible? If so, how? Javascript: function soma(a, b) { return a + b; } Java: public…
-
4
votes1
answer89
viewsQ: Is it possible to replicate a Union in Java?
As unionthe ones I’m talking about are the same as C/C++. The goal of union is to save memory using the same region of it to store different data at different times. It’s like a hotel room.…
-
7
votes1
answer433
viewsA: What are logical properties in CSS?
The logical properties of CSS define a new way to work with the layout. Its main goal is to help developers support different writing systems such as scripts right-to-left (RTL) and displayed…
-
2
votes1
answer1262
viewsQ: What does "string" mean?
String in English means line. What this has to do with programming strings? Why do they call themselves that?
-
2
votes0
answers98
viewsQ: What is the difference between JVM, JRE and JDK
I have been researching and still do not understand very well the difference between them, mainly between the JRE and JDK. The JVM would be like the heart of Java, and besides I heard that it…
-
3
votes3
answers1072
viewsA: What is and what is the function of . (dot) in POO?
That operator is also referred to as Operator. As @Maniero’s response already speaks, he is an operator binary (has 2 operands in the form a.b) who accesses the members of an object or class as…
-
-2
votes1
answer153
viewsQ: What areas of mathematics should a game developer know?
In the development of a game something essential is mathematics. With it several amazing things are done both in the games and elsewhere. The difference between knowing or not this content is…
-
7
votes1
answer404
viewsQ: Why are certain languages faster than others?
I’ve heard a lot about how C is faster than C++ and Java, Lua is the language of script faster, among other examples. What makes certain languages faster than others? What defines a language as…
-
1
votes1
answer77
viewsQ: How to use 'Native' in Java?
In Java we have the keyword native. This keyword allows Java to delegate its execution to C and/or C++ allowing it to do certain things it is not able to. Whereas I know the concepts of C and C++,…
-
8
votes1
answer314
viewsQ: What is the correct term, key word or reserved word?
In programming we have certain "special words" that do specific things. These words are popularly called keywords or reserved words. What is the correct term for these words? Examples: if, double,…
terminologyasked NinjaTroll 1,752 -
13
votes2
answers587
viewsQ: What’s the difference between command, instruction and code?
What is the difference between them in the context of programming? I can use these terms interchangeably? If they are different, what is the correct term to define what we write?…
terminologyasked NinjaTroll 1,752 -
-6
votes1
answer150
viewsQ: Is it possible to delay the initialization of a constant?
With delay initialization, I say initialize a constant after your declaration. For example (pseudocode): const exemplo; exemplo = 2;
-
0
votes2
answers358
viewsA: Reference in Flyweight design pattern
Intrinsic data are those that are part of the essence of something. The heart is something intrinsic to the human being. The extrinsic data are those that vary. The skin tone is something extrinsic…
-
9
votes1
answer996
viewsA: What is the allow attribute in iframes and how to use it?
TL;DR This attribute may enable (allow) or disable (not allow) a feature of a third-party content. How it works To understand this attribute, we have to understand what is the Resource Policy. The…
htmlanswered NinjaTroll 1,752 -
-1
votes2
answers1028
viewsA: In white-space, what is the difference between pre, pre-line and pre-wrap options?
Taken from the Mozilla website (my translation with some modifications to increase understanding) (https://developer.mozilla.org/en-US/docs/Web/CSS/white-space): Values of white-space: normal Blank…
cssanswered NinjaTroll 1,752 -
4
votes1
answer742
viewsQ: What is the livelock?
The term deadlock is well known in concurrent programming, but I came across the term livelock in my studies, and I wondered what that might be? What is livelock? And could you give some example…
-
3
votes2
answers210
viewsA: How does an "if" work internally?
A compiler converts your source code to machine code, which is understandable by the computer. During the conversion process, the source code goes through several phases of the compiler. One of…
-
10
votes2
answers210
viewsQ: How does an "if" work internally?
The if is widely used in programming, and he plays several important roles in a programmer’s everyday life. The code seems to magically run if an expression is passed in the if is true, otherwise…
-
5
votes1
answer143
viewsQ: Why are instance variables usually initialized in the constructor?
I have seen several codes where the instance variables of a class are initialized in the constructor, even I do it myself by watching others do it. But I never understood it. Logical that has the…
-
4
votes1
answer75
viewsQ: When to use local classes in Java?
I learned that it is possible to declare classes within blocks as methods, for example: void exemplo() { class teste { } } But when local classes come in handy?…
-
2
votes1
answer229
viewsA: How to add a Library in the main module [ module-info.java ]?
You’re suffering from the automatic modules. Automatic modules are named modules that are automatically created for a non-modular JAR. This happens when the JAR is placed in the module-path…
-
-1
votes1
answer71
viewsQ: Is it possible to simulate the C++ 'Friend' keyword in Java?
Is there any way to simulate this in Java? I would like to have access to a private builder of one class in another, but this other class cannot be nested. This is for the logic of a game where I…
javaasked NinjaTroll 1,752 -
4
votes2
answers182
viewsA: can I declare a variable in javascript so $variable?
No, this is the PHP variable creation syntax, in Javascript we declare variables using var, let or const, followed by the name, and the value: var exemplo = "valor" Of course the value is optional,…
-
0
votes2
answers99
viewsA: Why can’t I print according to the state?
Try: Main: import java.util.Scanner; public class Main { public static void main (String [] args) { Scanner sc = new Scanner(System.in); System.out.println("Comando 'ligar' ou 'desligar' lampada.");…
javaanswered NinjaTroll 1,752 -
12
votes2
answers285
viewsQ: To what extent does hardware affect programming?
Nowadays the world is very dependent on the technology and the benefits it brings. Most of the time we are writing several lines of code that will be converted into machine language and thus give…
-
0
votes1
answer145
viewsA: Unusual problem in the Eclipse
Try to put it in the file eclipse.ini (will probably be in the Eclipse installation directory) the following line just before the sentence -vmargs: -vm %JAVA_HOME%\bin\javaw.exe If it doesn’t work,…
-
4
votes1
answer96
viewsQ: How does provides...with and 'uses' work in modular Java?
In Java 9, as a result of the Jigsaw project, we gained the ability to define modules. The modules are very simple, but there are still two things that confuse me in them, which is the use of…
-
3
votes1
answer74
viewsQ: How does CPU cache performance work?
Recently I discovered that it is possible to get a huge performance when using the CPU cache. An example I saw was a program that reduced its runtime from 10 seconds to 200 milliseconds just using…
-
4
votes1
answer110
viewsQ: What are the benefits of peer programming?
Programming was almost always done by a person, who creates, analyzes, tests and compiles the code, all by himself. Until a moment came programming in pairs, that said programming in pairs was more…
methodologyasked NinjaTroll 1,752 -
0
votes1
answer381
viewsQ: What is the purpose of operating system variables related to Java?
There are environment variables that Java uses to perform certain actions, such as JAVA_HOME, CLASSPATH, Path, ... Most of the material talking about these variables are confusing, often some…
javaasked NinjaTroll 1,752 -
2
votes1
answer381
viewsA: What is the purpose of operating system variables related to Java?
I will give examples on Windows, but all that changes are the folder paths. Environment variables in general are used as a way to configure some application in a simpler way. Java looks for this…
javaanswered NinjaTroll 1,752 -
22
votes5
answers1841
viewsQ: Why are there so many programming languages?
Several decades ago, programming languages emerged to make life easier for programmers and indirectly, for the general public as well. In the beginning, everything was done with buttons that…
language-independentasked NinjaTroll 1,752 -
3
votes1
answer219
viewsQ: What is the "real" meaning of the key word 'extends' in Java?
First of all, I know how to use and work the keyword extends, my real doubt lies in the meaning of that word, more precisely because extends and not inherit or something like that? The only thing…
-
2
votes1
answer97
viewsQ: How does it work and why use the Command project standard?
I’ve been studying the design standards and I’ve come across the Command design standard. I still don’t quite understand how it works, correct me if I’m wrong, but from what I saw why I should…
-
4
votes1
answer1078
viewsQ: Delay in Java
Is it possible to delay in Java? Like for example, I have two messages and I want the second one to appear just a few seconds later,?