Expand|Select|Wrap|Line Numbers
- public class bytes {
- public static void main(final String... args) {
- System.out.println("Hi");
- }
- }
Expand|Select|Wrap|Line Numbers
- public class bytes {
- public static void main (String... args) {
- String[] str = {"I ", "haven't ", "received ", "my ", "answer." };
- args[0] = "hi";
- System.out.println(args[0]);
- args =str;
- for(int i=0; i<args.length; i++) {
- System.out.print(args[i]);
- }
- }
- }
Expand|Select|Wrap|Line Numbers
- javac bytes Nisrin
Expand|Select|Wrap|Line Numbers
- hi
Now repeat the process with the final keyword.
Expand|Select|Wrap|Line Numbers
- public class bytes {
- public static void main (final String... args) {
- String[] str = {"I ", "haven't ", "received ", "my ", "answer." };
- args[0] = "hi";
- System.out.println(args[0]);
- args =str;
- for(int i=0; i<args.length; i++) {
- System.out.print(args[i]);
- }
- }
- }
Because I am now assigning str to args.
As I am following this source https://www.scaler.com/topics/java/f...yword-in-java/, this indicates I have made a significant difference by include the final keyword in the argument and making it constant in the main method. I'm updating the primary method's signature. So, why am I not receiving any compilation or runtime errors?