This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// how to terminate a Java application | |
import java.io.File; | |
public class AppTerminate { | |
public static void main(String[] args) { | |
File file = new File("config.xml"); | |
int errCode = 0; | |
if (!file.exists()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# echo 1 = clear pagecache, echo 2 clears dentries and inodes, echo 3 clear Pagecache, dentries and inodes | |
su -c "echo 3 >'/proc/sys/vm/drop_caches' && swapoff -a && swapon -a && printf '\n%s\n' 'Ram-cache and Swap Cleared'" root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include <stdio.h> | |
int main() | |
{ | |
char a[100]; //assuming that string size will not exceed 100 | |
scanf("%s",a); //read a string in array a | |
printf("%s",a); //print out array a | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
int n; | |
scanf("%d",&n); //read input integer from STDIN | |
printf("%d",n); //print output integer to STDOUT | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Node class | |
class Node: | |
# Function to initialize the node object | |
def __init__(self, v): | |
self.val = v # Assign value | |
self.next = None # Initialize next as null | |
# Linked List class | |
class ListNode: | |
# Function to initialize the Linked List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Linked list class | |
class ListNode | |
{ | |
// head of list | |
Node head; | |
// Node class | |
class Node | |
{ | |
int val; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A linked list node | |
struct ListNode | |
{ | |
int val; | |
struct ListNode *next; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
main() | |
{ | |
int first[20], second[20], c, n; | |
cout << "Enter the number of elements in the array "; | |
cin >> n; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scanner sc = new Scanner(System.in); | |
int i = sc.nextInt(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int intArray[]; //Declaring Array | |
intArray = new int[20]; //Allocating Memory To Array | |
int[] intArray = new int[20]; //Combining Both Statements In One Line | |
int[] intArray = new int[]{ 1,2,3,4,5,6,7,8,9,10 }; //Declaring A Literal Array |
NewerOlder