Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I say that you should take either C++ or Java first. They are both very similar, only the syntax is different. I can't say anything about C# because I have never learned it, but C++ was easy to learn for me and Java is almost the same.
Nice to hear. How is your career turning out? That is, what weight is behind your recommendation?I learned Python, then C#, then C, then C++.
In C#, you have to deal with memory management. In some cases, more so than C++.If you start on C++ though, Java and C# will seem very easy in retrospect to not having to deal with memory management when you want/need to learn them.
In C#, you have to deal with memory management. In some cases, more so than C++.
Nothing is free. C# does reference counting and cleans up memory it thinks you're not using. Because of the design of the langauge and the run time, there's a threshold where this is good enough for your applicaiton, and where it isn't. For instance, it would be a pretty bad idea to write a server using C# because it would stop processing requests every so often in order to do garbage collection. If it's acceptable that your server quits responding every so often, then that's fine -- go for it.Please elaborate.
// Can you spot the "memory leak"?
public class Stack {
private Object[] elements;
private int size = 0;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
public Stack() {
elements = new Object[DEFAULT_INITIAL_CAPACITY];
}
public void push(Object e) {
ensureCapacity();
elements[size++] = e;
}
public Object pop() {
if (size == 0) {
throw new EmptyStackException();
}
return elements[--size];
}
/**
* Ensure space for at least one more element, roughly
* doubling the capacity each time the array needs to grow.
*/
private void ensureCapacity() {
if (elements.length == size) {
elements = Arrays.copyOf(elements, 2 * size + 1);
}
}
}