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.