Tutor profile: Rushil D.
Subject: Java Programming
Does Java use pointers? Why or why not?
Java does not allow explicit use of pointers to the user. The user can instantiate objects with a certain variable name and then pass that variable name around as a memory address like a regular pointer. The reason there are no explicit pointers is to avoid the many possible pointer bugs that occur from incorrect freeing and reassigning. Problems like dangling pointers are very easy to run into for beginners, and so Java's lack of explicit pointers is an advantage as a starting language for coders.
If the length of a rectangle is 7 less than four times the width, and the perimeter is 106, find its length and width.
Because it is a rectangle, the perimeter is 2 times the length + 2 times the width. Let the length be l and width be w. This means that 2l + 2w = 106. From the problem we know that l = 4w - 7. Substituting this expression in we get, 2(4w - 7) + 2w = 106. Simplifying we get, 10w - 14 = 106. Adding both sides by 14 then dividing by 10 we get, 10w = 120 and w = 12. This means that l = 4(12) - 7 = 41. Length is 41 and width is 12.
There are two numbers whose sum is 126. One number is five times the other. What are the numbers?
Let the two numbers be x and y. This means that x + y = 126. Let y be the number that is larger, this means that y = 5x In other words, x + y = x + 5x = 6x = 126. Dividing both sides by 6, we get x is 21. This means y = 5x = 105. The two numbers are 21 and 105.
needs and Rushil will reply soon.