Level | Operator | Description | Associativity |
---|---|---|---|
1 | = += -= *= /= %= | Assignment Addition assignment Subtraction assignment Multiplication assignment Division assignment Modulus assignment | Right |
2 | ? : | Ternary conditional | Right |
3 | || | Logical OR | Left |
4 | && | Logical AND | Left |
5 | | | Bitwise inclusive OR | Left |
6 | ^ | Bitwise exclusive OR | Left |
7 | & | Bitwise AND | Left |
8 | == != | Relational is equal to Relational is not equal to | Left |
9 | < <= > >= instanceof | Relational less than Relational less than or equal Relational greater than Relational greater than or equal Type comparison (objects only) | Left |
10 | << >> >>> | Bitwise left shift Bitwise right shift with sign extension Bitwise right shift with zero extension | Left |
11 | + - | Addition Subtraction | Left |
12 | * / % | Multiplication Division Modulus | Left |
13 | ++ -- + - ! ~ ( type ) | Unary pre-increment Unary pre-decrement Unary plus Unary minus Unary logical negation Unary bitwise complement Unary type cast | Right |
14 | ++ -- | Unary post-increment Unary post-decrement | Right |
15 | () [] · | Parentheses Array subscript Member selection | Left |
Tips and good resources for all.. Oracle, Big data, Hadoop, Unix, Linux
Wednesday, October 14, 2015
Operator Precedence in Java.
Java has well-defined rules for execution order in which the operators in an expression are evaluated when the expression has several operators. Below are the execution orders i.e. precedence in Java Coding.
How to imporve efficiency while working in Unix/Linux?
There are various flavors of Unix/Linux currently available in market.Below techniques which would be helpful to you while working in Unix/Linux.
1. Using history command
2. Using pipe (|) instead of two commands
Here, history and grep command used to get the output of history command having "myword" word used in earlier command executions.
3. Use of ! and !! command
! command is used for to execute last command which is used in Unix/Linux, whether it successfully executed or not.
eg.
In Unix, After doing ls –lrt myword.txt, I need to open the file myword.txt, you can use command like - vi !$. Here !$ is the last argument of the shell.
In Linux, if you have installed vim editor , you can use it like - !vim,
This method saves your 30-35% time time at a time of critical conditions.
Depending on Unix/Linux flavor and depends on shell, sometime SSH client like Putty, MultiTabbed Putty, etc. also require some settings, with that you can refer previous command with help of keyboard Up and Down arrows.
!! command is used to execute the very last command you have executed and extremely fast as in processing. It works on the shells in which Up and Down arrow not working.
4. Use CTRL+R
It is used for repeating the last matching command.
Usage of this method is like that press CTRL+R and type "myword" which i have used in last command.Unix/Linux will find "myword" and once displaying the search result, you just need to press "Enter" to execute that command.
5. Use of aliases
You have to define aliases , in your bash profile .profile or .bashrc file, which are used by your frequently while working. You can find this file by using ls -a command in your home directory.
eg.
"l" which finds all files.
"l." which finds all hidden files.
"ls" which finds all files of using option - ls -lrt.
"cdh" which finds all files of using option - cd /home/myyword directory.
6. Using regular expression in grep and find and common commands like cd.
grep and find are two best commands provided by Unix/Linux mainly to search in a file , a directory , certain words in file e.g. ERROR or Warning.
eg.
grep "error" *.tmp | grep "warning" *.tmp - Using two grep command for finding error and warning individually.
egrep "error|warning" *.tmp - Instead of using two grep command for finding error and warning individually, usage of a single command.
cd - to switch between two directories in Unix/Linux.
7. Use of CTRL+Z, fg and bg commands
Use CTRL+Z and fg and bg to suspend a process running for a particular task.
Use fg and bg to run a particular command to run in background and foreground.
eg.
fg 1 - last background command or job to bring on foreground.
fg 2 - second last background command or job to bring it on foreground.
Lastly, You have to Minimize the key strokes or increase the speed of typing, in Unix/Linux to get quicker output. You have to learn more n more commands with different options and usage of them, it will reduce your thinking time and increase your productivity.
Some techniques might work in one flavor of Linux, but same might be not work for you.
1. Using history command
It is a Unix/Linux command used to get list of commands fired on Unix/Linux kernel.
You can use command as history | grep "mykeyword" to get desired list of commands which you have used recently.
HISTSIZE - a unix/linux environment variable, which specifies how many command history can store.2. Using pipe (|) instead of two commands
Here, history and grep command used to get the output of history command having "myword" word used in earlier command executions.
3. Use of ! and !! command
! command is used for to execute last command which is used in Unix/Linux, whether it successfully executed or not.
eg.
In Unix, After doing ls –lrt myword.txt, I need to open the file myword.txt, you can use command like - vi !$. Here !$ is the last argument of the shell.
In Linux, if you have installed vim editor , you can use it like - !vim,
This method saves your 30-35% time time at a time of critical conditions.
Depending on Unix/Linux flavor and depends on shell, sometime SSH client like Putty, MultiTabbed Putty, etc. also require some settings, with that you can refer previous command with help of keyboard Up and Down arrows.
!! command is used to execute the very last command you have executed and extremely fast as in processing. It works on the shells in which Up and Down arrow not working.
4. Use CTRL+R
It is used for repeating the last matching command.
Usage of this method is like that press CTRL+R and type "myword" which i have used in last command.Unix/Linux will find "myword" and once displaying the search result, you just need to press "Enter" to execute that command.
5. Use of aliases
You have to define aliases , in your bash profile .profile or .bashrc file, which are used by your frequently while working. You can find this file by using ls -a command in your home directory.
eg.
"l" which finds all files.
"l." which finds all hidden files.
"ls" which finds all files of using option - ls -lrt.
"cdh" which finds all files of using option - cd /home/myyword directory.
6. Using regular expression in grep and find and common commands like cd.
grep and find are two best commands provided by Unix/Linux mainly to search in a file , a directory , certain words in file e.g. ERROR or Warning.
eg.
grep "error" *.tmp | grep "warning" *.tmp - Using two grep command for finding error and warning individually.
egrep "error|warning" *.tmp - Instead of using two grep command for finding error and warning individually, usage of a single command.
cd - to switch between two directories in Unix/Linux.
7. Use of CTRL+Z, fg and bg commands
Use CTRL+Z and fg and bg to suspend a process running for a particular task.
Use fg and bg to run a particular command to run in background and foreground.
eg.
fg 1 - last background command or job to bring on foreground.
fg 2 - second last background command or job to bring it on foreground.
Lastly, You have to Minimize the key strokes or increase the speed of typing, in Unix/Linux to get quicker output. You have to learn more n more commands with different options and usage of them, it will reduce your thinking time and increase your productivity.
Some techniques might work in one flavor of Linux, but same might be not work for you.
Subscribe to:
Posts (Atom)