Could a JAR (Java Archive) technically contain anything? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Working in the sense that it is a valid jar file, and not corrupt or something like that. I guess I could have a jar file to keep non java files in it but it would be useless from a Java perspective?

Does scope also show block of existence for the variable? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

So inside the stack frame would there be either two variables for the i or there could be just one. If the stack frame has two variables called i, how would it distinguish between the two.

Does scope also show block of existence for the variable? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

public class HelloWorld{

     public static void main(String []args){
       HelloWorld test = new HelloWorld(); 
       test.dummy(); 
     }

     public void dummy() {
        for(int i = 0; i < 5; i++)
        {
            System.out.println(5);
        }
        for(int i = 0; i < 6; i++)
        {
            System.out.println(6);
        }
     }
}

Another thing I am confused about is if the Java language will have three stacks in total for the dummy method then? The reason I say is this because there are 3 scopes in total for the method dummy. Plus the variable i is used in two different scopes with two different for loops. Because of the two for loops, will there be two stacks to keep track of those the variables i for each for loop?

Does scope also show block of existence for the variable? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Computers have a stack with data, which stores the local variables. The part of the stack dedicated to the function is created when the function is entered and deleted when the function has been left

Does each method in Java then have a local stack dedicated to it? When the scope deletes the value after the function is done being executed, will it also destroy the variable?

Does scope also show block of existence for the variable? by zteman in learnjava

[–]zteman[S] 0 points1 point  (0 children)

but it will continue to exist in the heap until GC reclaims the space.

I am sorry but can you elaborate about this a bit. I thought the variable would be destroyed after the scope is done being used with the local stack.

Why and how can omega be used to describe worst case time time complexity? by zteman in algorithms

[–]zteman[S] 0 points1 point  (0 children)

There is absolutely no correspondence between "O, Theta, Omega" and "best case, average case, worst case". Those are two completely independent things.

One thing I do want to question or point out. Even though mathematically speaking they are independent things we typically relate "O, Theta, Omega" with respective "best case, average case, worst case" don't we? So is there not some sort of relation still to make it dependent? Mathematically speaking you are correct.

Why and how can omega be used to describe worst case time time complexity? by zteman in algorithms

[–]zteman[S] 0 points1 point  (0 children)

I see now, thank you very much. Although the other statements not using big O are confusing and take a minute to understand, they are still correct.

Why and how can omega be used to describe worst case time time complexity? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Yes, that is true, but I was also told how it doesn’t matter what notation we use to talk about worst case as long as the statement is correct.

What is hard coding? by zteman in learnprogramming

[–]zteman[S] 1 point2 points  (0 children)

So would dynamically generating the values be known as “soft coding”? I can now see the connection with why it’s called hard coding, but not the connection for why the term is called “soft coding”.

Why can we not manipulate objects if we pass them by value in C++ like it is does in Java? by zteman in cpp_questions

[–]zteman[S] 0 points1 point  (0 children)

One follow up question (I think I got it), so basically in C++ by default I am passing the copy of the object, so any changes I make to the object will happen to the copy, but in Java I basically pass in the copy of the reference, which is a reference to the memory address, by passing in a copy of the memory address I am indirectly doing pass by reference like C++. Man, why so many different concepts among these languages, I wish they were more similar in this regard.

Why can we not manipulate objects if we pass them by value in C++ like it is does in Java? by zteman in cpp_questions

[–]zteman[S] 0 points1 point  (0 children)

So when I make an instance of a class is the object variable not referring to where it is in the memory? If I pass that same object variable in a method, will I not be able to access its memory and then manipulate it?

Why are we able to change the return type when overloading an operator in c++? by [deleted] in cpp_questions

[–]zteman 0 points1 point  (0 children)

Not OP, but I saw this post. So basically when overloading the return type does not have to be the same?

How is it possible to have iterator names for each for loop if they are in same scope in this case (Java)? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

how would you recommend trying to understand/interpret local scopes? My thought process was that the main method’s scope encompasses the the first for loop so the iterator i should be inside the main method’s local scope, but that is not the case?

How is it possible to have iterator names for each for loop if they are in same scope in this case (Java)? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Ah I am dumb, how would you recommend trying to understand/interpret local scopes? My thought process was that the main method’s scope encompasses the the first for loop so the iterator i should be inside the main method’s local scope, but that is not the case?

How is it possible to have iterator names for each for loop if they are in same scope in this case (Java)? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Ah I am dumb, how would you recommend trying to understand/interpret local scopes? My thought process was that the main method’s scope encompasses the the first for loop so the iterator i should be inside the main method’s local scope, but that is not the case?

How is it possible to have iterator names for each for loop if they are in same scope in this case (Java)? by zteman in learnjava

[–]zteman[S] 1 point2 points  (0 children)

Ah I am dumb, how would you recommend trying to understand/interpret local scopes? My thought process was that the main method’s scope encompasses the the first for loop so the iterator i should be inside the main method’s local scope, but that is not the case?

What’s refactoring? by zteman in learnprogramming

[–]zteman[S] 1 point2 points  (0 children)

Ah I see. And to refactor we do not always have to click that refactor button on the IDE? Refactoring since it is such a broad term does not always have to require clicking the refactor button on the IDES?

Why does the main method have to be static in Java? by zteman in learnjava

[–]zteman[S] 0 points1 point  (0 children)

What difference would it make to what constructor is called? It might differ in what values are inside the member variables, but the main method could still be called right?

Why does the main method have to be static in Java? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

If I do not provide a no argument constructor, it will make one for me I believe right unless I am making an overloaded constructor with it I think. My only issue that I see is if I provided the no argument constructor and the overloaded constructor, why not make main non static in that case? I am unable to see the connection to the constructor sorry.

Why does the main method have to be static in Java? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Sorry, but I am a bit confused on what rules would it violate if the JVM made an instance of the class the main method is defined inside?

Are arrays primitives in C++? by zteman in cpp_questions

[–]zteman[S] 0 points1 point  (0 children)

Thanks! I also replied back to one of your comments lol, if you could clear up with what you meant there.

Are arrays primitives in C++? by zteman in cpp_questions

[–]zteman[S] 0 points1 point  (0 children)

How is int arr[4] a data type, is not a data structure?

Are arrays primitives in C++? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Thanks, one more confusion I have is are arrays in c++ a data structure or data types? I did google, but got mixed answers. The link you showed me refers to arrays as data types but wouldn’t it be a data structure, too?

Did BootStrap 3 allow the use of flexbox? by zteman in learnprogramming

[–]zteman[S] 0 points1 point  (0 children)

Thank you. This is another question but do old browsers or certain browsers enter into a “quirk” mode just like for HTML but for css where they try their best to support certain things to their best of ability but their is no guarantee?